Skip to content

Commit

Permalink
[Minor] Use a scalar variable as a dir handle
Browse files Browse the repository at this point in the history
instead of a bareword
  • Loading branch information
moisseev committed Apr 6, 2023
1 parent 9e6105e commit fcfff55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils/rspamd_stats.pl
Original file line number Diff line number Diff line change
Expand Up @@ -678,20 +678,20 @@ ()

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 =
Expand Down

0 comments on commit fcfff55

Please sign in to comment.