"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fail2ban/server/utils.py" between
fail2ban-0.10.5.tar.gz and fail2ban-0.11.1.tar.gz

About:

utils.py  (fail2ban-0.10.5):utils.py  (fail2ban-0.11.1)
skipping to change at line 351 skipping to change at line 351
"""Check whether pid exists in the current process table. """ """Check whether pid exists in the current process table. """
import errno import errno
if pid < 0: if pid < 0:
return False return False
try: try:
os.kill(pid, 0) os.kill(pid, 0)
except OSError as e: except OSError as e:
return e.errno == errno.EPERM return e.errno == errno.EPERM
else: else:
return True return True
else: # pragma : no cover (no windows currently supported) else: # pragma: no cover (no windows currently supported)
@staticmethod @staticmethod
def pid_exists(pid): def pid_exists(pid):
import ctypes import ctypes
kernel32 = ctypes.windll.kernel32 kernel32 = ctypes.windll.kernel32
SYNCHRONIZE = 0x100000 SYNCHRONIZE = 0x100000
process = kernel32.OpenProcess(SYNCHRONIZE, 0, pid) process = kernel32.OpenProcess(SYNCHRONIZE, 0, pid)
if process != 0: if process != 0:
kernel32.CloseHandle(process) kernel32.CloseHandle(process)
return True return True
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)