chiark / gitweb /
sd-event: don't require a signal event source to be enabled for the child event sourc...
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Jul 2014 14:48:35 +0000 (16:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 11 Jul 2014 14:50:10 +0000 (16:50 +0200)
src/libsystemd/sd-event/sd-event.c

index a21f7db..9a9664c 100644 (file)
@@ -1919,14 +1919,13 @@ static int process_signal(sd_event *e, uint32_t events) {
         int r;
 
         assert(e);
-        assert(e->signal_sources);
 
         assert_return(events == EPOLLIN, -EIO);
 
         for (;;) {
                 struct signalfd_siginfo si;
                 ssize_t ss;
-                sd_event_source *s;
+                sd_event_source *s = NULL;
 
                 ss = read(e->signal_fd, &si, sizeof(si));
                 if (ss < 0) {
@@ -1941,16 +1940,19 @@ static int process_signal(sd_event *e, uint32_t events) {
 
                 read_one = true;
 
-                s = e->signal_sources[si.ssi_signo];
                 if (si.ssi_signo == SIGCHLD) {
                         r = process_child(e);
                         if (r < 0)
                                 return r;
-                        if (r > 0 || !s)
+                        if (r > 0)
                                 continue;
-                } else
-                        if (!s)
-                                return -EIO;
+                }
+
+                if (e->signal_sources)
+                        s = e->signal_sources[si.ssi_signo];
+
+                if (!s)
+                        continue;
 
                 s->signal.siginfo = si;
                 r = source_set_pending(s, true);