|
|
d8cdcb3 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
d8cdcb3 |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
d8cdcb3 |
Date: Wed, 15 May 2019 01:46:00 +0200
|
|
|
d8cdcb3 |
Subject: [PATCH] blscfg: Don't leave grub_errno set to an error if the command
|
|
|
d8cdcb3 |
succeeded
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
After a command is executed, the function grub_print_error() is called to
|
|
|
d8cdcb3 |
print any active error messages if these exist.
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
The blscfg command calls to the grub_strtol() function to try to convert
|
|
|
d8cdcb3 |
the default entry string to a number, in case the default is an index.
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
If this function is not able to do the conversion, it sets the grub_errno
|
|
|
d8cdcb3 |
variable to GRUB_ERR_BAD_NUMBER. But the blscfg command wrongly left that
|
|
|
d8cdcb3 |
set and so the caller would be confused thinking that the command failed
|
|
|
d8cdcb3 |
and that an error message has to be printed.
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
This caused the first error in the stack to be printed, polluting the GRUB
|
|
|
d8cdcb3 |
output and preventing the menu to be hidden. So reset the grub_error var
|
|
|
d8cdcb3 |
to GRUB_ERR_NONE again if was set to GRUB_ERR_BAD_NUMBER by grub_strtol().
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
Resolves: rhbz#1699761
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
d8cdcb3 |
---
|
|
|
d8cdcb3 |
grub-core/commands/blscfg.c | 4 +++-
|
|
|
d8cdcb3 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
|
|
d8cdcb3 |
index bd008b04bec..26dbe873fe4 100644
|
|
|
d8cdcb3 |
--- a/grub-core/commands/blscfg.c
|
|
|
d8cdcb3 |
+++ b/grub-core/commands/blscfg.c
|
|
|
d8cdcb3 |
@@ -999,8 +999,10 @@ is_default_entry(const char *def_entry, struct bls_entry *entry, int idx)
|
|
|
d8cdcb3 |
return true;
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
def_idx = (int)grub_strtol(def_entry, NULL, 0);
|
|
|
d8cdcb3 |
- if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
|
|
d8cdcb3 |
+ if (grub_errno == GRUB_ERR_BAD_NUMBER) {
|
|
|
d8cdcb3 |
+ grub_errno = GRUB_ERR_NONE;
|
|
|
d8cdcb3 |
return false;
|
|
|
d8cdcb3 |
+ }
|
|
|
d8cdcb3 |
|
|
|
d8cdcb3 |
if (def_idx == idx)
|
|
|
d8cdcb3 |
return true;
|