Selaa lähdekoodia

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

sbingner 25 vuotta sitten
vanhempi
commit
0ec9f4e42e
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  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");