mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
core: change how crash_shell and crash_reboot interact
Instead of freezing in PID1 and letting the forked child freeze or reboot when exec("/bin/sh") fails, just wait for the child's exit and then do the freeze_or_reboot in PID1 as usual. This means that when both crash_shell and crash_reboot are enabled, the system will reboot after the shell exits.
This commit is contained in:
parent
647cb08bc3
commit
4cf0b03b97
@ -922,9 +922,8 @@
|
||||
the machine automatically when it crashes, after a 10s delay.
|
||||
Otherwise, the system will hang indefinitely. Defaults to
|
||||
<option>no</option>, in order to avoid a reboot loop. If
|
||||
combined with <varname>systemd.crash_shell=</varname>, it is
|
||||
first attempted to invoke a shell, and if this is not
|
||||
successful the system is rebooted.</para></listitem>
|
||||
combined with <varname>systemd.crash_shell=</varname>, the
|
||||
system is rebooted after the shell exits.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -231,11 +231,10 @@ noreturn static void crash(int sig) {
|
||||
(void) execle("/bin/sh", "/bin/sh", NULL, environ);
|
||||
|
||||
log_emergency_errno(errno, "execle() failed: %m");
|
||||
freeze_or_reboot();
|
||||
_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
log_info("Spawned crash shell as PID "PID_FMT".", pid);
|
||||
freeze();
|
||||
(void) wait_for_terminate(pid, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user