diff options
author | John Ericson <git@JohnEricson.me> | 2022-10-28 23:22:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 23:22:18 +0100 |
commit | 13f2a6f38db44385ae1c7d3d01170149de328abb (patch) | |
tree | 9184949feb826f00b7a5bc4175dda4667055e44c /src/libstore/optimise-store.cc | |
parent | 12461e246b02371c6b6981b4e65985e9397474e1 (diff) | |
parent | b7e8a3bf4cbb2448db860f65ea13ef2c64b6883b (diff) |
Merge branch 'master' into indexed-store-path-outputs
Diffstat (limited to 'src/libstore/optimise-store.cc')
-rw-r--r-- | src/libstore/optimise-store.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index 8af9b1dde..4d2781180 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -229,7 +229,9 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, } /* Atomically replace the old file with the new hard link. */ - if (rename(tempLink.c_str(), path.c_str()) == -1) { + try { + renameFile(tempLink, path); + } catch (SysError & e) { if (unlink(tempLink.c_str()) == -1) printError("unable to unlink '%1%'", tempLink); if (errno == EMLINK) { @@ -240,7 +242,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, debug("'%s' has reached maximum number of links", linkPath); return; } - throw SysError("cannot rename '%1%' to '%2%'", tempLink, path); + throw; } stats.filesLinked++; |