1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

manager: avoid infinite loop for unexpected waitid() error (#8168)

I think if we log the error as being _ignored_, we should also consider
the event as handled and clear it.  This was the behaviour prior to
575b300b (PR #7968).

I don't think we particularly wanted to change behaviour and keep retrying.
Sometimes that's useful, other times you cause more problems by filling the
logs.

Plus a nearby typo fix.
This commit is contained in:
Alan Jenkins 2018-02-13 18:04:31 +00:00 committed by Lennart Poettering
parent 372771c8d3
commit 8afabc5090

View File

@ -2121,11 +2121,10 @@ static int manager_dispatch_sigchld(sd_event_source *source, void *userdata) {
if (waitid(P_ALL, 0, &si, WEXITED|WNOHANG|WNOWAIT) < 0) {
if (errno == ECHILD)
goto turn_off;
if (errno != ECHILD)
log_error_errno(errno, "Failed to peek for child with waitid(), ignoring: %m");
log_error_errno(errno, "Failed to peek for child with waitid(), ignoring: %m");
return 0;
goto turn_off;
}
if (si.si_pid <= 0)
@ -2258,7 +2257,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
case SIGCHLD:
r = sd_event_source_set_enabled(m->sigchld_event_source, SD_EVENT_ON);
if (r < 0)
log_warning_errno(r, "Failed to enable SIGCHLD even source, ignoring: %m");
log_warning_errno(r, "Failed to enable SIGCHLD event source, ignoring: %m");
break;