Remove unneeded scratchpad array when reading serials file
authorJacob Bachmeyer <jcb@gnu.org>
Fri, 21 Oct 2022 01:55:22 +0000 (20:55 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Fri, 21 Oct 2022 01:55:22 +0000 (20:55 -0500)
gatekeeper.pl

index a9acff168e5fcf56968d3abb997f56400c6c4ce5..3ac55860f196c8cc74f31f0fca430af4922be5d2 100755 (executable)
@@ -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 = <SERIALS>;
-    foreach (@serials) {
-      my ($tmp1,$tmp2) = /(.*?):(.*?)\n/;
-      $tmp1 =~ s/\s+//g;
-      $tmp2 =~ s/\s+//g;
-      $serials{$tmp1} = $tmp2;
+    local *_;
+    while (<SERIALS>) {
+      s/\s+//g;
+      m/^(.*?):(.*?)$/
+       or ftp_abort "bad line in serials file: [$_]";
+      $serials{$1} = $2;
     }
   }
   seek(SERIALS,0,0);