From df685d5784e0cfdd89b6153bde886b071afff388 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 8 Mar 2018 10:57:44 +0100 Subject: [PATCH] systemctl: propagate the error from kexec --- src/systemctl/systemctl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index e00cbb2b12..3be01321b6 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3524,7 +3524,6 @@ static int load_kexec_kernel(void) { if (r < 0) return r; if (r == 0) { - const char* const args[] = { KEXEC, "--load", kernel, @@ -3537,7 +3536,13 @@ static int load_kexec_kernel(void) { _exit(EXIT_FAILURE); } - return wait_for_terminate_and_check("kexec", pid, WAIT_LOG); + r = wait_for_terminate_and_check("kexec", pid, WAIT_LOG); + if (r < 0) + return r; + if (r > 0) + /* Command failed */ + return -EPROTO; + return 0; } static int set_exit_code(uint8_t code) { -- 2.25.1