chiark / gitweb /
util: make use of newly added reset_signal_mask() call wherever appropriate
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Aug 2014 19:11:35 +0000 (21:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Aug 2014 19:12:54 +0000 (21:12 +0200)
src/core/execute.c
src/core/main.c
src/nspawn/nspawn.c
src/shared/util.c

index b5b22472d5a9f8ff954ad409484e4cef7aaedca8..066efd6fdf1c41ec0b90c51dfae13cbe212de7fd 100644 (file)
@@ -1301,7 +1301,6 @@ int exec_spawn(ExecCommand *command,
                 int dont_close[n_fds + 3];
                 uid_t uid = (uid_t) -1;
                 gid_t gid = (gid_t) -1;
-                sigset_t ss;
                 int i, err;
 
                 /* child */
@@ -1319,9 +1318,8 @@ int exec_spawn(ExecCommand *command,
                 if (context->ignore_sigpipe)
                         ignore_signals(SIGPIPE, -1);
 
-                assert_se(sigemptyset(&ss) == 0);
-                if (sigprocmask(SIG_SETMASK, &ss, NULL) < 0) {
-                        err = -errno;
+                err = reset_signal_mask();
+                if (err < 0) {
                         r = EXIT_SIGNAL_MASK;
                         goto fail_child;
                 }
index bd148b1b33642c444d13c25ff7cf7687fab2afca..95ab40fffc09135e72c4031ce7503d5f24da60b3 100644 (file)
@@ -1834,7 +1834,6 @@ finish:
         if (reexecute) {
                 const char **args;
                 unsigned i, args_size;
-                sigset_t ss;
 
                 /* Close and disarm the watchdog, so that the new
                  * instance can reinitialize it, but doesn't get
@@ -1918,12 +1917,10 @@ finish:
                 args[i++] = NULL;
                 assert(i <= args_size);
 
-                /* reenable any blocked signals, especially important
+                /* Reenable any blocked signals, especially important
                  * if we switch from initial ramdisk to init=... */
                 reset_all_signal_handlers();
-
-                assert_se(sigemptyset(&ss) == 0);
-                assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
+                reset_signal_mask();
 
                 if (switch_root_init) {
                         args[0] = switch_root_init;
index 2c718557ee98876e18378f03fd5d31926828dac2..56d9cc68c669275d5a1d06ae90be15c236932e5f 100644 (file)
@@ -3156,9 +3156,7 @@ int main(int argc, char *argv[]) {
                         kmsg_socket_pair[0] = safe_close(kmsg_socket_pair[0]);
 
                         reset_all_signal_handlers();
-
-                        assert_se(sigemptyset(&mask) == 0);
-                        assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
+                        reset_signal_mask();
 
                         k = open_terminal(console, O_RDWR);
                         if (k != STDIN_FILENO) {
index 98c07163da28e8e871ef976392300c67f8d94bbe..fdcf5719fa54d0b9b3b47de0c24e60a785c6107b 100644 (file)
@@ -3890,16 +3890,13 @@ void execute_directory(const char *directory, DIR *d, usec_t timeout, char *argv
                 _cleanup_hashmap_free_free_ Hashmap *pids = NULL;
                 _cleanup_closedir_ DIR *_d = NULL;
                 struct dirent *de;
-                sigset_t ss;
 
                 /* We fork this all off from a child process so that
                  * we can somewhat cleanly make use of SIGALRM to set
                  * a time limit */
 
                 reset_all_signal_handlers();
-
-                assert_se(sigemptyset(&ss) == 0);
-                assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
+                reset_signal_mask();
 
                 assert_se(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0);