#769 Numeric sort error for logfile rotation

This commit is contained in:
Oliver Gorwits
2021-02-24 10:46:34 +00:00
parent 6a714c43c8
commit 9816bb5148
3 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2.047005 - 2021-02-24
[BUG FIXES]
* #769 Numeric sort error for logfile rotation
2.047004 - 2021-02-15 2.047004 - 2021-02-15
[BUG FIXES] [BUG FIXES]

View File

@@ -168,7 +168,7 @@ sub rotate_logs {
((-s $log_file) > ($logsize * 1024768)); ((-s $log_file) > ($logsize * 1024768));
my @files = grep { /$log_file\.\d+/ } glob file($log_dir, '*'); my @files = grep { /$log_file\.\d+/ } glob file($log_dir, '*');
foreach my $f (sort { $b <=> $a } @files) { foreach my $f (sort { $b cmp $a } @files) {
next unless $f =~ m/$log_file\.(\d+)$/; next unless $f =~ m/$log_file\.(\d+)$/;
my $pos = $1; my $pos = $1;
unlink $f if $pos == ($logfiles - 1); unlink $f if $pos == ($logfiles - 1);

View File

@@ -183,7 +183,7 @@ sub rotate_logs {
((-s $log_file) > ($logsize * 1024768)); ((-s $log_file) > ($logsize * 1024768));
my @files = grep { /$log_file\.\d+/ } glob file($log_dir, '*'); my @files = grep { /$log_file\.\d+/ } glob file($log_dir, '*');
foreach my $f (sort { $b <=> $a } @files) { foreach my $f (sort { $b cmp $a } @files) {
next unless $f =~ m/$log_file\.(\d+)$/; next unless $f =~ m/$log_file\.(\d+)$/;
my $pos = $1; my $pos = $1;
unlink $f if $pos == ($logfiles - 1); unlink $f if $pos == ($logfiles - 1);