]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: change how crash_shell and crash_reboot interact
authorMichal Schmidt <mschmidt@redhat.com>
Wed, 30 Sep 2015 13:12:19 +0000 (15:12 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Wed, 7 Oct 2015 12:24:49 +0000 (14:24 +0200)
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.

man/systemd.xml
src/core/main.c

index 391333bfb4696810a4223e47ba99ed3377db3dc5..8d74ca49c3f5160de8cc0df9ba99141d780c52a8 100644 (file)
         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>
index 2fa96901c7d5d8d29e4c3369fff2f78511dfa15d..13fa78fed8a80a51bd44e4a7512c35ca45066d0c 100644 (file)
@@ -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);
                 }
         }