- 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
0.6
Cyril Jaquier 2005-12-16 23:50:59 +00:00
parent 15806fc3da
commit 9cd787c50e
1 changed files with 6 additions and 1 deletions

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]