]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
manager: avoid infinite loop for unexpected waitid() error (#8168)
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Tue, 13 Feb 2018 18:04:31 +0000 (18:04 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Feb 2018 18:04:31 +0000 (19:04 +0100)
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.

src/core/manager.c

index 5021e00b870e4ababc3f569bc1bebec91452facd..a2a3eea2f52cc7f23d1bbf1ab073ccafa22ef965 100644 (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;