From b8878b301103c142195f25f72a41d31a4dc45e08 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 28 Mar 2006 13:31:40 +0000 Subject: [PATCH] Bugfixing --- LogRotate.pm | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/LogRotate.pm b/LogRotate.pm index dcb5bf5..d317de2 100644 --- a/LogRotate.pm +++ b/LogRotate.pm @@ -369,9 +369,21 @@ sub find_rotatings($$$) { my $ext = defined $f->{'extension'} ? $f->{'extension'} : ""; $ext = "" if $ext =~ /^\s*$/; $ext = "." . $ext if $ext ne "" and $ext !~ /^\./; + my $ext_ohne = $ext; - my ( $i, $pair, $t, $t_new ); + # Compress-Endung hinten dran bammeln ... + if ( $f->{'compress'} ) { + my $ce = $self->{'c'}->compressext(); + if ( not defined($ce) or $ce =~ /^\s*$/ ) { + $ce = ".gz"; + } + $ce = "." . $ce if $ce ne "" and $ce !~ /^\./; + $ext .= $ce; + } + + my ( $i, $pair, $t, $t_ohne, $t_new, $t_new_ohne ); $t = $target . $ext; + $t_ohne = $target . $ext_ohne; $i = 0; my $res = { @@ -382,24 +394,27 @@ sub find_rotatings($$$) { # Ziel der eigentlichen Rotation festlegen if ( $file eq $t ) { $t = $target . ".0" . $ext; + $t_ohne = $target . ".0" . $ext_ohne; $i = 1; } $res->{'rotate'}{'from'} = $file; - $res->{'rotate'}{'to'} = $t; + $res->{'rotate'}{'to'} = $t_ohne; # Rotationsziel gibt's nicht, okay, raus hier - return $res unless -f $t; + return $res unless -f $t or -f $t_ohne; - print $p . "Rotationsziel '$t' gibt's schon, ermittle zyklische Rotationen ...\n" if verbose() > 2; + print $p . "Rotationsziel '$t_ohne' gibt's schon, ermittle zyklische Rotationen ...\n" if verbose() > 2; # restliche Rotationen festlegen ... - while ( -f $t ) { + while ( -f $t or -f $t_ohne ) { $t_new = $target . "." . $i . $ext; - print $p . "Zyklische Rotation '$t' -> '$t_new'.\n" if verbose() > 3; - $pair = { 'from' => $t, - 'to' => $t_new, + $t_new_ohne = $target . "." . $i . $ext_ohne; + print $p . "Zyklische Rotation '$t_ohne' -> '$t_new_ohne'.\n" if verbose() > 3; + $pair = { 'from' => $t_ohne, + 'to' => $t_new_ohne, }; unshift @{$res->{'move'}}, $pair; $t = $t_new; + $t_ohne = $t_new_ohne; $i++; } -- 2.39.5