7e98da0
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
7e98da0
From: Javier Martinez Canillas <javierm@redhat.com>
7e98da0
Date: Tue, 9 Apr 2019 12:30:38 +0200
7e98da0
Subject: [PATCH] Fix systemctl kexec exit status check
7e98da0
7e98da0
There's always an error printed even when the systemctl kexec command does
7e98da0
succeed. That's because systemctl executes it asynchronously, but the emu
7e98da0
loader seems to expect it to be synchronous and that should never return.
7e98da0
7e98da0
Also, it's wrong to test if kexecute == 1 since we already know that's the
7e98da0
case or otherwise the function wouldn't had called grub_fatal() earlier.
7e98da0
7e98da0
Finally, systemctl kexec failing shouldn't be a fatal error since the emu
7e98da0
loader fallbacks to executing the kexec command in case of a failure.
7e98da0
7e98da0
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
7e98da0
---
7e98da0
 grub-core/loader/emu/linux.c | 6 ++++--
7e98da0
 1 file changed, 4 insertions(+), 2 deletions(-)
7e98da0
7e98da0
diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c
7e98da0
index fda9e00d24c..5b85b225eed 100644
7e98da0
--- a/grub-core/loader/emu/linux.c
7e98da0
+++ b/grub-core/loader/emu/linux.c
7e98da0
@@ -71,8 +71,10 @@ grub_linux_boot (void)
7e98da0
 		(kexecute==1) ? "do-or-die" : "just-in-case");
7e98da0
   rc = grub_util_exec (systemctl);
7e98da0
 
7e98da0
-  if (kexecute == 1)
7e98da0
-    grub_fatal (N_("Error trying to perform 'systemctl kexec'"));
7e98da0
+  if (rc == GRUB_ERR_NONE)
7e98da0
+    return rc;
7e98da0
+
7e98da0
+  grub_error (rc, N_("Error trying to perform 'systemctl kexec'"));
7e98da0
 
7e98da0
   /* need to check read-only root before resetting hard!? */
7e98da0
   grub_printf("Performing 'kexec -e'");