]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
locale: set sd_event_add_signal()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Jul 2018 05:59:36 +0000 (14:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Jul 2018 05:59:36 +0000 (14:59 +0900)
src/locale/localed.c

index b8f95b69a62eb053a809bf8f287da5e693c1b409..71115c59d7882598b2d1ba922b6058946c825eea 100644 (file)
@@ -21,6 +21,7 @@
 #include "macro.h"
 #include "path-util.h"
 #include "selinux-util.h"
+#include "signal-util.h"
 #include "string-util.h"
 #include "strv.h"
 #include "user-util.h"
@@ -738,13 +739,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)