about summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-01T09·23+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-01T09·23+0000
commit06b44242860d62e12f9abe018c6f974ceaa30bb9 (patch)
tree20a13dc912ca34f70eeb13276ab1dc6a45395615 /src/libstore/store.cc
parent32fa82a56a2c4a937c91f72be16339b4ddf7cdf1 (diff)
* Add missing files to dist.
* Fix GC and substitute bugs related to self-references.  Add a
  regression test.

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);
     }