Explorar el Código

correct bug where it would not die cleanly with missing files ending with .bz/.bz2/.gz and clean up regex slightly

sbingner hace 25 años
padre
commit
0ec9f4e42e
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      pisg.pl

+ 2 - 2
pisg.pl

@@ -388,9 +388,9 @@ sub parse_file
     # This parses the file..
     print "Analyzing log($file) in '$conf->{format}' format...\n";
 
-    if ($file =~ /.bz$/ || $file =~ /.bz2$/) {
+    if ($file =~ /.bz2{0,1}$/ && -f $file) {
         open (LOGFILE, "bunzip2 -c $file |") or die("$0: Unable to open logfile($file): $!\n");
-    } elsif ($file =~ /.gz$/) {
+    } elsif ($file =~ /.gz$/ && -f $file) {
         open (LOGFILE, "gunzip -c $file |") or die("$0: Unable to open logfile($file): $!\n");
     } else {
         open (LOGFILE, $file) or die("$0: Unable to open logfile($file): $!\n");