From: Jacob Bachmeyer Date: Fri, 21 Oct 2022 01:55:22 +0000 (-0500) Subject: Remove unneeded scratchpad array when reading serials file X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b016bd0740b46c0e3dd1f540b17236a2785ed48a;p=gatekeeper.git Remove unneeded scratchpad array when reading serials file --- diff --git a/gatekeeper.pl b/gatekeeper.pl index a9acff1..3ac5586 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1486,7 +1486,6 @@ sub advance_timestamp_ratchet { # Now we need to flock the our 'serials' file; # verify the epoch value there/update it, etc. my %serials = (); - my @serials = (); if (!-e $serials_path) { open(SERIALS,">$serials_path"); @@ -1494,12 +1493,12 @@ sub advance_timestamp_ratchet { } else { open(SERIALS,"+<$serials_path"); flock(SERIALS,2); # Take exclusive lock - @serials = ; - foreach (@serials) { - my ($tmp1,$tmp2) = /(.*?):(.*?)\n/; - $tmp1 =~ s/\s+//g; - $tmp2 =~ s/\s+//g; - $serials{$tmp1} = $tmp2; + local *_; + while () { + s/\s+//g; + m/^(.*?):(.*?)$/ + or ftp_abort "bad line in serials file: [$_]"; + $serials{$1} = $2; } } seek(SERIALS,0,0);