about summary refs log tree commit diff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-05T02·18+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-05T02·18+0000
commita9c4f66cfb1618833cc70ceaf13733730b634193 (patch)
tree47d3b9aab72f561e2e15f18b8ad415153bfd56ef /src/libstore/gc.cc
parent29cf434a35d82529f56c085c9cd50858c148d086 (diff)
* Allow unprivileged users to run the garbage collector and to do
  `nix-store --delete'.  But unprivileged users are not allowed to
  ignore liveness.
* `nix-store --delete --ignore-liveness': ignore the runtime roots as
  well.

Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index e5217c9b8636..4d8f25e655fc 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -1,4 +1,3 @@
-#include "gc.hh"
 #include "globals.hh"
 #include "misc.hh"
 #include "pathlocks.hh"
@@ -428,7 +427,7 @@ static Paths topoSort(const PathSet & paths)
 }
 
 
-void collectGarbage(GCAction action, const PathSet & pathsToDelete,
+void LocalStore::collectGarbage(GCAction action, const PathSet & pathsToDelete,
     bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed)
 {
     result.clear();
@@ -446,7 +445,7 @@ void collectGarbage(GCAction action, const PathSet & pathsToDelete,
 
     /* Find the roots.  Since we've grabbed the GC lock, the set of
        permanent roots cannot increase now. */
-    Roots rootMap = ignoreLiveness ? Roots() : findRoots(true);
+    Roots rootMap = ignoreLiveness ? Roots() : nix::findRoots(true);
 
     PathSet roots;
     for (Roots::iterator i = rootMap.begin(); i != rootMap.end(); ++i)
@@ -456,7 +455,8 @@ void collectGarbage(GCAction action, const PathSet & pathsToDelete,
        NIX_ROOT_FINDER environment variable.  This is typically used
        to add running programs to the set of roots (to prevent them
        from being garbage collected). */
-    addAdditionalRoots(roots);
+    if (!ignoreLiveness)
+        addAdditionalRoots(roots);
 
     if (action == gcReturnRoots) {
         result = roots;