about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nix-collect-garbage.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in
index 20c6731a14b5..fc67f1d55d1b 100755
--- a/scripts/nix-collect-garbage.in
+++ b/scripts/nix-collect-garbage.in
@@ -26,10 +26,14 @@ foreach my $link (@links) {
     $link = $linkdir . "/" . $link;
     next if (!($link =~ /.gcroot$/));
     open ROOT, "<$link" or die "cannot open $link: $!";
-    my $root = <ROOT>;
-    chomp $root;
+    while (<ROOT>) {
+        chomp;
+        foreach my $root (split ' ') {
+            die "bad root `$root' in file `$link'" unless $root =~ /^\S+$/;
+            push @roots, $root;
+        }
+    }
     close ROOT;
-    push @roots, $root;
 }
 
 my $extraarg = "";