mirror of https://github.com/fail2ban/fail2ban
- Re-activated subprocess module
- A return code different than 0 is considered as an error git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@428 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
f74657f4b6
commit
a522d9b6d7
|
@ -25,7 +25,7 @@ __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
|||
__license__ = "GPL"
|
||||
|
||||
import logging, os
|
||||
#from subprocess import call
|
||||
from subprocess import call
|
||||
|
||||
# Gets the instance of the logger.
|
||||
logSys = logging.getLogger("fail2ban.actions.action")
|
||||
|
@ -214,13 +214,13 @@ class Action:
|
|||
logSys.debug(realCmd)
|
||||
try:
|
||||
# The following line gives deadlock with multiple jails
|
||||
#retcode = call(realCmd, shell=True)
|
||||
retcode = os.system(realCmd)
|
||||
if retcode < 0:
|
||||
logSys.error("%s returned %x" % (realCmd, -retcode))
|
||||
else:
|
||||
logSys.debug("%s returned %x" % (realCmd, retcode))
|
||||
retcode = call(realCmd, shell=True)
|
||||
#retcode = os.system(realCmd)
|
||||
if retcode == 0:
|
||||
logSys.debug("%s returned successfully" % realCmd)
|
||||
return True
|
||||
else:
|
||||
logSys.error("%s returned %x" % (realCmd, retcode))
|
||||
except OSError, e:
|
||||
logSys.error("%s failed with %s" % (realCmd, e))
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue