From 71180f8e57f8fbb55978b00a13990c79093ff7b3 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Sun, 22 Mar 2020 10:41:18 +0100 Subject: [PATCH] Fall back to kexec when no kexec binary exists 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c index 15e6c1799e7..918cf20bd0a 100644 --- a/src/shutdown/shutdown.c +++ b/src/shutdown/shutdown.c @@ -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); } -- 2.47.3