]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Use a scalar variable as a dir handle 4457/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 6 Apr 2023 14:22:52 +0000 (17:22 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Thu, 6 Apr 2023 14:22:52 +0000 (17:22 +0300)
instead of a bareword

utils/rspamd_stats.pl

index e90524d2039380be023041f19fa35bc44ca3f656..9c5f2acb07e5f3e1d09f62de149c2b2c5e5105e1 100755 (executable)
@@ -678,20 +678,20 @@ sub JsonObjectElt() {
 
 sub GetLogfilesList {
     my ($dir) = @_;
-    opendir( DIR, $dir ) or die $!;
+    opendir( my $fh, $dir ) or die $!;
 
     my $pattern = join( '|', keys %decompressor );
     my $re      = qr/\.[0-9]+(?:\.(?:$pattern))?/;
 
     # Add unnumbered logs first
     my @logs =
-      grep { -f "$dir/$_" && !/$re/ } readdir(DIR);
+      grep { -f "$dir/$_" && !/$re/ } readdir($fh);
 
     # Add numbered logs
-    rewinddir(DIR);
-    push( @logs, ( sort numeric ( grep { -f "$dir/$_" && /$re/ } readdir(DIR) ) ) );
+    rewinddir($fh);
+    push( @logs, ( sort numeric ( grep { -f "$dir/$_" && /$re/ } readdir($fh) ) ) );
 
-    closedir(DIR);
+    closedir($fh);
 
     # Select required logs and revers their order
     @logs =