aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-01 19:14:30 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-01 19:14:58 -0400
commit967d066d8e452e59507ebae7585d6f34a4edf687 (patch)
tree15607d4c9389a274dda1ce659a41e10b06c98f12 /src/libstore
parent1df702d34733e69599a6ae21cb366348a2534b7d (diff)
nix-store --gc: Make ‘--max-freed 0’ do the right thing
That is, delete almost nothing (it will still remove unused links from /nix/store/.links).
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/gc.cc4
-rw-r--r--src/libstore/store-api.cc4
-rw-r--r--src/libstore/store-api.hh3
3 files changed, 5 insertions, 6 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index a7547d079..7753b3fe2 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -550,7 +550,7 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path)
} else
deleteGarbage(state, path);
- if (state.options.maxFreed && state.results.bytesFreed + state.bytesInvalidated > state.options.maxFreed) {
+ if (state.results.bytesFreed + state.bytesInvalidated > state.options.maxFreed) {
printMsg(lvlInfo, format("deleted or invalidated more than %1% bytes; stopping") % state.options.maxFreed);
throw GCLimitReached();
}
@@ -675,7 +675,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
throw Error(format("cannot delete path `%1%' since it is still alive") % *i);
}
- } else {
+ } else if (options.maxFreed > 0) {
if (shouldDelete(state.options.action))
printMsg(lvlError, format("deleting garbage..."));
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index b64988268..dac581e14 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -2,7 +2,7 @@
#include "globals.hh"
#include "util.hh"
-#include <limits.h>
+#include <climits>
namespace nix {
@@ -12,7 +12,7 @@ GCOptions::GCOptions()
{
action = gcDeleteDead;
ignoreLiveness = false;
- maxFreed = 0;
+ maxFreed = ULLONG_MAX;
}
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 9ba67852e..c0fb50f23 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -48,8 +48,7 @@ struct GCOptions
/* For `gcDeleteSpecific', the paths to delete. */
PathSet pathsToDelete;
- /* Stop after at least `maxFreed' bytes have been freed. 0 means
- no limit. */
+ /* Stop after at least `maxFreed' bytes have been freed. */
unsigned long long maxFreed;
GCOptions();