فهرست منبع

Update logic on logsuffix matching to remove possibility of infinite loop if the last file in the array does not match logsuffix

sbingner 23 سال پیش
والد
کامیت
64ea9fbce0
1فایلهای تغییر یافته به همراه15 افزوده شده و 6 حذف شده
  1. 15 6
      modules/Pisg/Parser/Logfile.pm

+ 15 - 6
modules/Pisg/Parser/Logfile.pm

@@ -151,16 +151,22 @@ sub _parse_dir
                 push @month, $month;
             } else {
                 splice(@filesarray,$#month + 1, 1);
-                $file = $filesarray[$#month + 1];
-                goto LOOPSTART;
+                if ($file = $filesarray[$#month + 1]) {
+                    goto LOOPSTART;
+                } else {
+                    last;
+                }
             }
             if ($file =~ /$dreg/) {
                 push @day, $1;
             } else {
                 splice(@filesarray,$#day + 1, 1);
                 splice(@month,$#day + 1);
-                $file = $filesarray[$#day + 1];
-                goto LOOPSTART;
+                if ($file = $filesarray[$#day + 1]) {
+                    goto LOOPSTART;
+                } else {
+                    last;
+                }
             }
             if ($file =~ /$yreg/) {
                 push @year, $1;
@@ -168,8 +174,11 @@ sub _parse_dir
                 splice(@filesarray,$#year + 1, 1);
                 splice(@month,$#year + 1);
                 splice(@day,$#year + 1);
-                $file = $filesarray[$#year + 1];
-                goto LOOPSTART;
+                if ($file = $filesarray[$#year + 1]) {
+                    goto LOOPSTART;
+                } else {
+                    last;
+                }
             }
         }
         my @newarray = @filesarray[ sort {