From 92daebc0d0268c35f416c1665e0da3d4be5dd69f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 11 Jul 2014 16:48:35 +0200 Subject: [PATCH] sd-event: don't require a signal event source to be enabled for the child event source to work --- src/libsystemd/sd-event/sd-event.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c index a21f7db..9a9664c 100644 --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c @@ -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); -- 1.7.9.2