diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-05-05 23:53:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-05-05 23:53:17 +0200 |
commit | 856a5a7d769826019d86bc52ae1bc2ed7b13ad44 (patch) | |
tree | f84e0d9617fed2e44259f390b601fdc1d7c6f683 /src/shared | |
parent | 73dec31974a315f4329fb302d8efe0e24b9da1d4 (diff) |
timesyncd: lookup name server via sd-resolve, support IPv6, react to SIGINT/SITERM
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); |