mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-08-03 22:27:49 +00:00
BF: general Exception catch was excessive. Only IOError and OSError are possible and has different meanings
This commit is contained in:
parent
6e77427516
commit
c8c7b0b984
1 changed files with 6 additions and 1 deletions
|
|
@ -477,10 +477,15 @@ class FileFilter(Filter):
|
|||
# Try to open log file.
|
||||
try:
|
||||
container.open()
|
||||
except Exception, e:
|
||||
# see http://python.org/dev/peps/pep-3151/
|
||||
except IOError, e:
|
||||
logSys.error("Unable to open %s" % filename)
|
||||
logSys.exception(e)
|
||||
return False
|
||||
except OSError, e: # pragma: no cover - requires race condition to tigger this
|
||||
logSys.error("Error opening %s" % filename)
|
||||
logSys.exception(e)
|
||||
return False
|
||||
|
||||
while True:
|
||||
line = container.readline()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue