From 2c1a0785c594148f875a490ed1dbad490a71b116 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Wed, 26 Oct 2005 21:49:05 +0000 Subject: [PATCH] - Better exception handling in isModified() git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_5@205 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- logreader/logreader.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/logreader/logreader.py b/logreader/logreader.py index 37fe23a99..1876a3953 100644 --- a/logreader/logreader.py +++ b/logreader/logreader.py @@ -97,15 +97,15 @@ class LogReader: """ try: self.logStats = os.stat(self.logPath) + if self.lastModTime == self.logStats.st_mtime: + return False + else: + logSys.debug(self.logPath+" has been modified") + self.lastModTime = self.logStats.st_mtime + return True except OSError: logSys.error("Unable to get stat on "+self.logPath) - - if self.lastModTime == self.logStats.st_mtime: return False - else: - logSys.debug(self.logPath+" has been modified") - self.lastModTime = self.logStats.st_mtime - return True def setFilePos(self, file): """ Sets the file position. We must take care of log file rotation