]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Fall back to kexec when no kexec binary exists
authorArusekk <arek_koz@o2.pl>
Sun, 22 Mar 2020 09:41:18 +0000 (10:41 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 24 Mar 2020 08:50:11 +0000 (09:50 +0100)
This may be not a popular setup, but in case kexec resides somewhere different
than the default location for KEXEC (`/usr/sbin/kexec`), don't just reboot and
try doing `reboot(RB_KEXEC)` instead, just like what `kexec -e` normally does.

src/shutdown/shutdown.c

index 15e6c1799e71451ad846ed16f0af7e79c464257b..918cf20bd0a760a264ff3c09977d97aa10f57a80 100644 (file)
@@ -547,6 +547,9 @@ int main(int argc, char *argv[]) {
                                 /* Child */
 
                                 execv(args[0], (char * const *) args);
+
+                                /* execv failed (kexec binary missing?), so try simply reboot(RB_KEXEC) */
+                                (void) reboot(cmd);
                                 _exit(EXIT_FAILURE);
                         }