summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-20 16:58:21 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-20 19:32:05 +0200
commit9bfcda9528636914aef3e0ab91191bb81654c83d (patch)
treee2d0e9bd92c67953e7ff222b5fe977522fb57b15
parent2f3b873a49734f8ecc8d929612d33153acbda891 (diff)
core: clean-up signal reset logic when reexec
There's no need to save the old sigmask, if we are going to die. Let's simplify this. Also, reset all the signal handlers, so that we don't leave SIG_IGN set for some of them across reexec.
-rw-r--r--src/core/main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 863ba527cc..6981e722d9 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1824,7 +1824,7 @@ finish:
if (reexecute) {
const char **args;
unsigned i, args_size;
- sigset_t ss, o_ss;
+ sigset_t ss;
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
@@ -1910,8 +1910,10 @@ finish:
/* reenable any blocked signals, especially important
* if we switch from initial ramdisk to init=... */
- sigemptyset(&ss);
- sigprocmask(SIG_SETMASK, &ss, &o_ss);
+ reset_all_signal_handlers();
+
+ assert_se(sigemptyset(&ss) == 0);
+ assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
if (switch_root_init) {
args[0] = switch_root_init;
@@ -1931,8 +1933,6 @@ finish:
log_error("Failed to execute /bin/sh, giving up: %m");
} else
log_warning("Failed to execute /sbin/init, giving up: %m");
-
- sigprocmask(SIG_SETMASK, &o_ss, NULL);
}
if (arg_serialization) {