about summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r--src/libstore/store.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 396835013f05..c7b84e7c63fc 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -553,7 +553,10 @@ void deleteFromStore(const Path & _path)
 
     Transaction txn(nixDB);
     if (isValidPathTxn(txn, path)) {
-        if (getReferers(txn, path).size() > 0)
+        PathSet referers = getReferers(txn, path);
+        if (referers.size() > 1 ||
+            (referers.size() == 1 &&
+                *referers.begin() != path))
             throw Error(format("cannot delete path `%1%' because it is in use") % path);
         invalidatePath(path, txn);
     }