diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-20 16:58:21 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-06-21 11:02:25 -0400 |
commit | 92254f72bbea94b8e640b829e2a0aef2a1aa4a36 (patch) | |
tree | b4cb3d90221cafc8241239cf0eecf7bf789bce64 | |
parent | 3eb31d88fd664d55251102d8504d05426a97d0b3 (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.
(cherry picked from commit 9bfcda9528636914aef3e0ab91191bb81654c83d)
-rw-r--r-- | src/core/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/main.c b/src/core/main.c index 62f8140e8..b6795a0f0 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1780,7 +1780,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 @@ -1866,8 +1866,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; @@ -1887,8 +1889,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) { |