From b016bd0740b46c0e3dd1f540b17236a2785ed48a Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 20 Oct 2022 20:55:22 -0500 Subject: [PATCH] Remove unneeded scratchpad array when reading serials file --- gatekeeper.pl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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); -- 2.25.1