nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0131-Fix-systemctl-kexec-exit-status-check.patch

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