diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.c | 19 | ||||
-rw-r--r-- | src/shared/util.h | 1 |
2 files changed, 19 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; diff --git a/src/shared/util.h b/src/shared/util.h index d584a65979..891fcee239 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -393,6 +393,7 @@ char* dirname_malloc(const char *path); void rename_process(const char name[8]); void sigset_add_many(sigset_t *ss, ...); +int sigprocmask_many(int how, ...); bool hostname_is_set(void); |