Improve waiting on children to exit.

If waitpid() returns -1 check if errno is ECHILD, just mark the worker
process as exited.

This could happen if Kore starts without keymgr/acme but those would still
be accounted for.
This commit is contained in:
Joris Vink 2020-01-17 21:43:56 +01:00
parent 445163f7c5
commit d8ff8e2c18

View File

@ -223,8 +223,11 @@ kore_worker_shutdown(void)
kw = WORKER(idx);
if (kw->pid != 0) {
pid = waitpid(kw->pid, &status, 0);
if (pid == -1)
if (pid == -1) {
if (errno == ECHILD)
kw->pid = 0;
continue;
}
#if defined(__linux__)
kore_seccomp_trace(kw->pid, status);