diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in index 20c6731a14..fc67f1d55d 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 = ; - chomp $root; + while () { + 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 = "";