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.
if (reexecute) {
const char **args;
unsigned i, args_size;
if (reexecute) {
const char **args;
unsigned i, args_size;
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
/* reenable any blocked signals, especially important
* if we switch from initial ramdisk to init=... */
/* 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;
if (switch_root_init) {
args[0] = switch_root_init;
log_error("Failed to execute /bin/sh, giving up: %m");
} else
log_warning("Failed to execute /sbin/init, giving up: %m");
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) {
}
if (arg_serialization) {