mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 13:02:37 +07:00
Send signal to every process in the same process group
When stopping a run/task/service we must send SIGTERM/KILL to all every process in the same process group. Otherwise we may end up with stray processes like 'logit' when log redirection is enabled. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+2
-2
@@ -476,7 +476,7 @@ static void service_kill(svc_t *svc)
|
||||
if (runlevel != 1)
|
||||
print_desc("Killing ", svc->desc);
|
||||
|
||||
kill(svc->pid, SIGKILL);
|
||||
kill(-svc->pid, SIGKILL);
|
||||
|
||||
/* Let SIGKILLs stand out, show result as [WARN] */
|
||||
if (runlevel != 1)
|
||||
@@ -539,7 +539,7 @@ static int service_stop(svc_t *svc)
|
||||
if (svc->pid <= 1)
|
||||
goto cleanup;
|
||||
|
||||
res = kill(svc->pid, svc->sighalt);
|
||||
res = kill(-svc->pid, svc->sighalt);
|
||||
|
||||
/* PID lost or forking process never really started */
|
||||
if (res == -1 && ESRCH == errno) {
|
||||
|
||||
Reference in New Issue
Block a user