diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-09-23 20:21:08 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-09-23 20:21:08 +0200 |
commit | 9a24ece122eb19f3b69f072f6ce3c39c5ae4d0ce (patch) | |
tree | c21179065d0cb5803fcb4a01a4c4f7be1abf72db | |
parent | 236d9ee7f72ca4238f5f44c244fd2b885691c6ad (diff) |
Fix exception
-rw-r--r-- | src/libstore/build.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 6b53f529a..f0820e711 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1675,7 +1675,7 @@ void DerivationGoal::tryLocalBuild() { } -void replaceValidPath(const Path & storePath, const Path tmpPath) +void replaceValidPath(const Path & storePath, const Path & tmpPath) { /* We can't atomically replace storePath (the original) with tmpPath (the replacement), so we have to move it out of the @@ -1685,8 +1685,9 @@ void replaceValidPath(const Path & storePath, const Path tmpPath) if (pathExists(storePath)) rename(storePath.c_str(), oldPath.c_str()); if (rename(tmpPath.c_str(), storePath.c_str()) == -1) { + auto ex = SysError("moving '%s' to '%s'", tmpPath, storePath); rename(oldPath.c_str(), storePath.c_str()); // attempt to recover - throw SysError("moving '%s' to '%s'", tmpPath, storePath); + throw ex; } deletePath(oldPath); } |