Skip to content

Commit 25b7f6b

Browse files
radolinDaniel Kiper
authored andcommitted
blsuki: Error out if unexpected arguments are supplied
This can be especially helpful, as the Fedora version of the blscfg actually made use of positional arguments, but current implementation switched to parameters. For example what used to be "blscfg (hd0,gpt2)/..." now should be "blscfg --path (hd0,gpt2)/...)". In case of old configs/scripts still supplying positional arguments we will now error out instead of just ignoring them and falling back to defaults silently. Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
1 parent cfeff5e commit 25b7f6b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

grub-core/commands/blsuki.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,19 +1458,23 @@ blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type)
14581458
}
14591459

14601460
static grub_err_t
1461-
grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
1461+
grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc,
14621462
char **args __attribute__ ((unused)))
14631463
{
1464+
if (argc != 0)
1465+
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected argument(s) found, see --help"));
14641466
return blsuki_cmd (ctxt, BLSUKI_BLS_CMD);
14651467
}
14661468

14671469
static grub_extcmd_t bls_cmd;
14681470

14691471
#ifdef GRUB_MACHINE_EFI
14701472
static grub_err_t
1471-
grub_cmd_uki (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)),
1473+
grub_cmd_uki (grub_extcmd_context_t ctxt, int argc,
14721474
char **args __attribute__ ((unused)))
14731475
{
1476+
if (argc != 0)
1477+
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected argument(s) found, see --help"));
14741478
return blsuki_cmd (ctxt, BLSUKI_UKI_CMD);
14751479
}
14761480

0 commit comments

Comments
 (0)