my $log_file;
if (defined($opt{"LOG_FILE"})) {
- my $size = 0;
+ my $whence = 0; # beginning of file
+ my $pos = $test_log_start;
+
if (defined($mail_max_size)) {
my $log_size = tell LOG;
$log_size -= $test_log_start;
if ($log_size > $mail_max_size) {
- $size = $log_size - $mail_max_size;
+ $whence = 2; # end of file
+ $pos = - $mail_max_size;
}
}
$log_file = "$tmpdir/log";
open (L, "$opt{LOG_FILE}") or die "Can't open $opt{LOG_FILE} to read)";
open (O, "> $tmpdir/log") or die "Can't open $tmpdir/log\n";
- seek(L, $test_log_start + $size, 0);
+ seek(L, $pos, $whence);
while (<L>) {
print O;
}