mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00: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:
1 parent
9b022ed7a4
commit
91a9c83928
1 file changed
+2
-2
+2
-2
@@ -476,7 +476,7 @@ static void service_kill(svc_t *svc)
|
|||||||
if (runlevel != 1)
|
if (runlevel != 1)
|
||||||
print_desc("Killing ", svc->desc);
|
print_desc("Killing ", svc->desc);
|
||||||
|
|
||||||
kill(svc->pid, SIGKILL);
|
kill(-svc->pid, SIGKILL);
|
||||||
|
|
||||||
/* Let SIGKILLs stand out, show result as [WARN] */
|
/* Let SIGKILLs stand out, show result as [WARN] */
|
||||||
if (runlevel != 1)
|
if (runlevel != 1)
|
||||||
@@ -539,7 +539,7 @@ static int service_stop(svc_t *svc)
|
|||||||
if (svc->pid <= 1)
|
if (svc->pid <= 1)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
res = kill(svc->pid, svc->sighalt);
|
res = kill(-svc->pid, svc->sighalt);
|
||||||
|
|
||||||
/* PID lost or forking process never really started */
|
/* PID lost or forking process never really started */
|
||||||
if (res == -1 && ESRCH == errno) {
|
if (res == -1 && ESRCH == errno) {
|
||||||
|
|||||||
Reference in new issue
Block a user