- Fixed crash when time format does not match data

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@223 a942ae1a-1317-0410-a47c-b1dcaea8d605
This commit is contained in:
lostcontrol 2005-12-16 23:50:59 +00:00
parent 15f248ee78
commit cc08e53736

View file

@ -201,7 +201,12 @@ class LogReader:
Pattern should describe the date construction of
value.
"""
date = list(time.strptime(value, self.timepattern))
try:
date = list(time.strptime(value, self.timepattern))
except ValueError, e:
logSys.error(e)
logSys.error("Please check the format and your locale settings.")
return None
if date[0] < 2000:
# There is probably no year field in the logs
date[0] = time.gmtime()[0]