commit aabbd9b5c07484ee5e4e7493778527b0801859e9 Author: Leonid Evdokimov leon@darkk.net.ru Date: Wed Oct 12 17:55:54 2016 +0300
SIG_DFL is not a signal, it's a signal handler
It's semantically wrong to call kill with SIG_DFL although it's having correct `0` value by chance. --- ooni/scripts/ooniprobe_agent.py | 2 +- ooni/utils/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ooni/scripts/ooniprobe_agent.py b/ooni/scripts/ooniprobe_agent.py index 49694eb..e670d86 100644 --- a/ooni/scripts/ooniprobe_agent.py +++ b/ooni/scripts/ooniprobe_agent.py @@ -168,7 +168,7 @@ def stop_agent(): while True: # poll once per second until we see the process is no longer running try: - os.kill(pid, signal.SIG_DFL) + os.kill(pid, 0) except OSError: print("process %d is dead" % pid) return diff --git a/ooni/utils/__init__.py b/ooni/utils/__init__.py index def533a..6abd04f 100644 --- a/ooni/utils/__init__.py +++ b/ooni/utils/__init__.py @@ -174,7 +174,7 @@ def get_ooni_root():
def is_process_running(pid): try: - os.kill(pid, signal.SIG_DFL) + os.kill(pid, 0) running = True except OSError as ose: if ose.errno == errno.EPERM: