Save process exit status to svc_t

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2020-02-05 07:23:06 +01:00
1 parent 225510a270
commit c3eca9fe8f
4 files changed
+11 -6

No files matched your search

+3 -2
View File
@@ -316,6 +316,7 @@ static void sigterm_cb(uev_t *w, void *arg, int events)
static void sigchld_cb(uev_t *w, void *arg, int events)
{
pid_t pid;
int status;
if (UEV_ERROR == events) {
_e("Unrecoverable error in signal watcher");
@@ -324,10 +325,10 @@ static void sigchld_cb(uev_t *w, void *arg, int events)
/* Reap all the children! */
do {
pid = waitpid(-1, NULL, WNOHANG);
pid = waitpid(-1, &status, WNOHANG);
if (pid > 0) {
_d("Collected child %d", pid);
service_monitor(pid);
service_monitor(pid, status);
}
} while (pid > 0);
}