X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain-afb-daemon.c;fp=src%2Fmain-afb-daemon.c;h=c2a5351375b36f34597a2888dcdfd5a593e7ca2e;hb=79d63b68dd5f4047a49ac178094afb2c206c167f;hp=4ef4b28014a42e0316029d8878b8b7700555a090;hpb=81f9cf2f0ca3ec74ffeb3092231d85023013315d;p=src%2Fapp-framework-binder.git diff --git a/src/main-afb-daemon.c b/src/main-afb-daemon.c index 4ef4b280..c2a53513 100644 --- a/src/main-afb-daemon.c +++ b/src/main-afb-daemon.c @@ -399,6 +399,17 @@ static struct afb_hsrv *start_http_server() | execute_command +--------------------------------------------------------- */ +static void wait_child_and_exit() +{ + pid_t pidchld = childpid; + + childpid = 0; + if (!SELF_PGROUP) + killpg(pidchld, SIGKILL); + waitpid(pidchld, NULL, 0); + exit(0); +} + static void on_sigchld(int signum, siginfo_t *info, void *uctx) { if (info->si_pid == childpid) { @@ -406,11 +417,9 @@ static void on_sigchld(int signum, siginfo_t *info, void *uctx) case CLD_EXITED: case CLD_KILLED: case CLD_DUMPED: - childpid = 0; - if (!SELF_PGROUP) - killpg(info->si_pid, SIGKILL); - waitpid(info->si_pid, NULL, 0); - exit(0); + jobs_exit(wait_child_and_exit); + default: + break; } } }