[Logcheck-commits] r1615 - logcheck/branches/zugschlus200707/src
zugschlus at users.alioth.debian.org
zugschlus at users.alioth.debian.org
Fri Jul 27 18:11:27 UTC 2007
Author: zugschlus
Date: 2007-07-27 18:11:27 +0000 (Fri, 27 Jul 2007)
New Revision: 1615
Modified:
logcheck/branches/zugschlus200707/src/logtail2
Log:
various minor stuff
Modified: logcheck/branches/zugschlus200707/src/logtail2
===================================================================
--- logcheck/branches/zugschlus200707/src/logtail2 2007-07-27 17:52:04 UTC (rev 1614)
+++ logcheck/branches/zugschlus200707/src/logtail2 2007-07-27 18:11:27 UTC (rev 1615)
@@ -53,7 +53,7 @@
# starting offset $offset.
print "print_from_offset $filename, $offset\n";
unless (open(LOGFILE, $filename)) {
- print STDERR "File $logfile cannot be read.\n";
+ print STDERR "File $logfile cannot be read: $!\n";
exit 66;
}
@@ -71,11 +71,9 @@
sub mtime {
my ($filename) = @_;
my $mtime = 0;
- if (-e $filename) {
- unless ($mtime = ((stat($filename))[8])) {
- print STDERR "Cannot get $filename mtime.\n";
- exit 65;
- }
+ unless (-e $filename && ($mtime = ((stat($filename))[8])) ) {
+ print STDERR "Cannot get $filename mtime: $!\n";
+ exit 65;
}
return $mtime;
}
@@ -83,11 +81,9 @@
sub inode {
my ($filename) = @_;
my $inode = 0;
- if (-e "$filename") {
- unless ($inode = ((stat($filename))[1])) {
- print STDERR "Cannot get $filename inode.\n";
- exit 65;
- }
+ unless (-e "$filename" && ($inode = ((stat($filename))[1])) ) {
+ print STDERR "Cannot get $filename inode: $!\n";
+ exit 65;
}
return $inode;
}
@@ -96,7 +92,7 @@
my ($filename) = @_;
my $dirname = dirname($filename);
unless (opendir(DIR, $dirname)) {
- print STDERR "Cannot open directory $dirname.\n";
+ print STDERR "Cannot open directory $dirname: $!\n";
exit 65;
}
my @direntries = readdir(DIR);
@@ -138,7 +134,7 @@
}
if (! -f $logfile) {
- print STDERR "File $logfile cannot be read.\n";
+ print STDERR "File $logfile cannot be read: $!\n";
exit 66;
}
unless ($offsetfile) {
@@ -164,8 +160,8 @@
}
# determine log file inode and size
- unless ((undef,$ino,undef,undef,undef,undef,undef,$size) = stat($logfile)) {
- print STDERR "Cannot get $logfile file size.\n";
+ unless (($ino,$size) = (stat($logfile))[1,7]) {
+ print STDERR "Cannot get $logfile file size: $!\n";
exit 65;
}
@@ -201,7 +197,7 @@
# update offset, unless test mode
unless ($TEST_MODE) {
unless (open(OFFSET, ">$offsetfile")) {
- print STDERR "File $offsetfile cannot be created. Check your permissions.\n";
+ print STDERR "File $offsetfile cannot be created. Check your permissions: $!\n";
exit 73;
}
print OFFSET "$ino\n$size\n";
More information about the Logcheck-commits
mailing list