This can be especially helpful, as the Fedora version of the blscfg
actually made use of arguments. In case of old configs/scripts the
new implementation will now error out instead of falling back to
defaults silently.

Signed-off-by: Radoslav Kolev <[email protected]>
---
 grub-core/commands/blsuki.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/grub-core/commands/blsuki.c b/grub-core/commands/blsuki.c
index 0fd4458e6..9911bcbe8 100644
--- a/grub-core/commands/blsuki.c
+++ b/grub-core/commands/blsuki.c
@@ -1409,7 +1409,7 @@ blsuki_create_entries (bool show_default, bool 
show_non_default, char *entry_id,
 }
 
 static grub_err_t
-blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
+blsuki_cmd (grub_extcmd_context_t ctxt, int argc, enum blsuki_cmd_type 
cmd_type)
 {
   grub_err_t err;
   struct grub_arg_list *state = ctxt->state;
@@ -1420,6 +1420,8 @@ blsuki_cmd (grub_extcmd_context_t ctxt, enum 
blsuki_cmd_type cmd_type)
   bool show_non_default = false;
   bool all = true;
   entries = NULL;
+  if (argc != 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no arguments expected, see 
--help"));
 
   if (state[0].set)
     path = state[0].arg;
@@ -1454,20 +1456,20 @@ blsuki_cmd (grub_extcmd_context_t ctxt, enum 
blsuki_cmd_type cmd_type)
 }
 
 static grub_err_t
-grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
+grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc,
                 char **args __attribute__ ((unused)))
 {
-  return blsuki_cmd (ctxt, BLSUKI_BLS_CMD);
+  return blsuki_cmd (ctxt, argc, BLSUKI_BLS_CMD);
 }
 
 static grub_extcmd_t bls_cmd;
 
 #ifdef GRUB_MACHINE_EFI
 static grub_err_t
-grub_cmd_uki (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
+grub_cmd_uki (grub_extcmd_context_t ctxt, int argc,
                 char **args __attribute__ ((unused)))
 {
-  return blsuki_cmd (ctxt, BLSUKI_UKI_CMD);
+  return blsuki_cmd (ctxt, argc, BLSUKI_UKI_CMD);
 }
 
 static grub_extcmd_t uki_cmd;
-- 
2.51.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to