X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain-afb-daemon.c;h=c2a5351375b36f34597a2888dcdfd5a593e7ca2e;hb=901a38c28bf3fe7cc3e58e3fad36190fbae585be;hp=4ef4b28014a42e0316029d8878b8b7700555a090;hpb=50deefa0f08b88b99748abd57560222744d2f8db;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; } } }