diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-07-20 14:59:23 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-07-20 14:59:23 +0900 |
commit | 754f0269355c10109f62a1b4a3a93558cfb7449f (patch) | |
tree | 77125752a5b13c5405f26cae6ff6bf4c3f25a24f /src | |
parent | f07b548940ed46722c54b15069a7f08739714659 (diff) | |
download | systemd-754f0269355c10109f62a1b4a3a93558cfb7449f.tar.gz systemd-754f0269355c10109f62a1b4a3a93558cfb7449f.tar.bz2 systemd-754f0269355c10109f62a1b4a3a93558cfb7449f.zip |
timedate: set sd_event_add_signal()
Diffstat (limited to 'src')
-rw-r--r-- | src/timedate/timedated.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index ad662fb1cf..4beded5de0 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -20,6 +20,7 @@ #include "list.h" #include "path-util.h" #include "selinux-util.h" +#include "signal-util.h" #include "string-util.h" #include "strv.h" #include "unit-def.h" @@ -909,13 +910,23 @@ int main(int argc, char *argv[]) { goto finish; } + assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0); + r = sd_event_default(&event); if (r < 0) { log_error_errno(r, "Failed to allocate event loop: %m"); goto finish; } - sd_event_set_watchdog(event, true); + (void) sd_event_set_watchdog(event, true); + + r = sd_event_add_signal(event, NULL, SIGINT, NULL, NULL); + if (r < 0) + return r; + + r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL); + if (r < 0) + return r; r = connect_bus(&context, event, &bus); if (r < 0) |