[Logcheck-devel] logtail2 sub mtime might contain an error ...

Robert A. Schmied ras at acm.org
Mon Jun 6 19:42:17 UTC 2011


aloha logcheck developers

i've been poking around with the latest git version logcheck-1.3.13
trying to see how/if it can be made compatible again with mostly stock
solaris 10 sparc and found that the subject mtime subroutine in logtail2
might have a latent defect (or it just might have a poorly selected name),
but it might be that i'm missing the larger picture too ...

as noted below it is selecting stat element 8 which is atime (last access time).
last modification time (mtime) is stat element 9 at least according to my
reading of the perl stat function.

while this might not normally be an issue, it can be if other accesses
are being made on the log files being stat'ed, which is the case for me
since i'm actively stat'ing my log files while i explore logcheck.


aloha

ras


sub mtime {
    my ($filename) = @_;
    my $mtime = 0;
#            this is file the last access time element --v
    unless (-e $filename && ($mtime = ((stat($filename))[8])) ) {
	print STDERR "Cannot get $filename mtime: $!\n";
	exit 65;
    }
    return $mtime;
}





More information about the Logcheck-devel mailing list