aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-04-06 22:07:28 +0100
committerGitHub <noreply@github.com>2023-04-06 22:07:28 +0100
commit22fd372d45b39660b2131f39d33360312ebdbcfc (patch)
treee31792b49877b3af71a77a65a2d4f95b20056541
parent9e6105e97392ab0e4e92b8d96211d344855769d9 (diff)
parentfcfff55f03afcf653eaabd2b38e5a6cfc6818d3a (diff)
downloadrspamd-22fd372d45b39660b2131f39d33360312ebdbcfc.tar.gz
rspamd-22fd372d45b39660b2131f39d33360312ebdbcfc.zip
Merge pull request #4457 from moisseev/rspamd-stats
[Minor] Use a scalar variable as a dir handle
-rwxr-xr-xutils/rspamd_stats.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl
index e90524d20..9c5f2acb0 100755
--- a/utils/rspamd_stats.pl
+++ b/utils/rspamd_stats.pl
@@ -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 =