mirror of https://github.com/fail2ban/fail2ban
BF: general Exception catch was excessive. Only IOError and OSError are possible and has different meanings
parent
6e77427516
commit
c8c7b0b984
|
@ -477,10 +477,15 @@ class FileFilter(Filter):
|
||||||
# Try to open log file.
|
# Try to open log file.
|
||||||
try:
|
try:
|
||||||
container.open()
|
container.open()
|
||||||
except Exception, e:
|
# see http://python.org/dev/peps/pep-3151/
|
||||||
|
except IOError, e:
|
||||||
logSys.error("Unable to open %s" % filename)
|
logSys.error("Unable to open %s" % filename)
|
||||||
logSys.exception(e)
|
logSys.exception(e)
|
||||||
return False
|
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:
|
while True:
|
||||||
line = container.readline()
|
line = container.readline()
|
||||||
|
|
Loading…
Reference in New Issue