diff options
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/sd-event.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c index 0317088af3..0b7b71d16e 100644 --- a/src/libsystemd-bus/sd-event.c +++ b/src/libsystemd-bus/sd-event.c @@ -22,6 +22,7 @@ #include <sys/epoll.h> #include <sys/timerfd.h> #include <sys/wait.h> +#include <pthread.h> #include "sd-id128.h" #include "sd-daemon.h" @@ -813,6 +814,7 @@ _public_ int sd_event_add_signal( sd_event_source **ret) { sd_event_source *s; + sigset_t ss; int r; assert_return(e, -EINVAL); @@ -823,6 +825,13 @@ _public_ int sd_event_add_signal( assert_return(e->state != SD_EVENT_FINISHED, -ESTALE); assert_return(!event_pid_changed(e), -ECHILD); + r = pthread_sigmask(SIG_SETMASK, NULL, &ss); + if (r < 0) + return -errno; + + if (!sigismember(&ss, sig)) + return -EBUSY; + if (!e->signal_sources) { e->signal_sources = new0(sd_event_source*, _NSIG); if (!e->signal_sources) |