about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-24T16·44+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-24T16·44+0100
commit152b1d6bf9c89b4db9848475e3000821e159d479 (patch)
tree2667ff6b2f8f91269fbb3a12fee4aa2fc53bdd04 /src/libstore/local-store.cc
parent28e7e29abdcdaf60ba8a5fad3738fe4a8f3db9a8 (diff)
deletePath(): Succeed if path doesn't exist
Also makes it robust against concurrent deletions.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index da4d932df6..33f2569128 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1365,7 +1365,7 @@ Path LocalStore::addToStoreFromDump(const string & dump, const string & name,
 
         if (repair || !isValidPath(dstPath)) {
 
-            if (pathExists(dstPath)) deletePath(dstPath);
+            deletePath(dstPath);
 
             if (recursive) {
                 StringSource source(dump);
@@ -1434,7 +1434,7 @@ Path LocalStore::addTextToStore(const string & name, const string & s,
 
         if (repair || !isValidPath(dstPath)) {
 
-            if (pathExists(dstPath)) deletePath(dstPath);
+            deletePath(dstPath);
 
             writeFile(dstPath, s);
 
@@ -1659,7 +1659,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
 
         if (!isValidPath(dstPath)) {
 
-            if (pathExists(dstPath)) deletePath(dstPath);
+            deletePath(dstPath);
 
             if (rename(unpacked.c_str(), dstPath.c_str()) == -1)
                 throw SysError(format("cannot move ‘%1%’ to ‘%2%’")