about summary refs log tree commit diff
path: root/src/nix-store
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 28cd1adf4027..e84288137990 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -531,7 +531,10 @@ static void opGC(Strings opFlags, Strings opArgs)
         else if (*i == "--print-live") options.action = GCOptions::gcReturnLive;
         else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead;
         else if (*i == "--delete") options.action = GCOptions::gcDeleteDead;
-        else if (*i == "--max-freed") options.maxFreed = getIntArg(*i, i, opFlags.end());
+        else if (*i == "--max-freed") {
+            options.maxFreed = getIntArg(*i, i, opFlags.end());
+            if (options.maxFreed == 0) options.maxFreed = 1;
+        }
         else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end());
         else if (*i == "--use-atime") options.useAtime = true;
         else if (*i == "--max-atime") {