summaryrefslogtreecommitdiff
path: root/src/shutdown/shutdown.c
diff options
context:
space:
mode:
authorArusekk <arek_koz@o2.pl>2020-03-22 10:41:18 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-24 09:50:11 +0100
commit71180f8e57f8fbb55978b00a13990c79093ff7b3 (patch)
treecb58e87202a16f44752ffa8614bdc6247e9fa9d5 /src/shutdown/shutdown.c
parentcdc6c95737d26b1746b446dfe662872d593d23c6 (diff)
downloadsystemd-71180f8e57f8fbb55978b00a13990c79093ff7b3.tar.gz
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.
Diffstat (limited to 'src/shutdown/shutdown.c')
-rw-r--r--src/shutdown/shutdown.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
index 15e6c1799e..918cf20bd0 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);
}