diff options
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 5bf9c9fabd..d1dc476ab6 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -2016,7 +2016,6 @@ int ignore_signals(int sig, ...) { va_list ap; int r = 0; - if (sigaction(sig, &sa, NULL) < 0) r = -errno; @@ -2442,6 +2441,24 @@ void sigset_add_many(sigset_t *ss, ...) { va_end(ap); } +int sigprocmask_many(int how, ...) { + va_list ap; + sigset_t ss; + int sig; + + assert_se(sigemptyset(&ss) == 0); + + va_start(ap, how); + while ((sig = va_arg(ap, int)) > 0) + assert_se(sigaddset(&ss, sig) == 0); + va_end(ap); + + if (sigprocmask(how, &ss, NULL) < 0) + return -errno; + + return 0; +} + char* gethostname_malloc(void) { struct utsname u; |