From b4cd82945a8f2ce728e160c316fb4d1b79c7c330 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 12 May 2010 17:43:49 +0530 Subject: [PATCH] minor fix --- script/execute.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/execute.c b/script/execute.c index d83f51914..d2e8753c3 100644 --- a/script/execute.c +++ b/script/execute.c @@ -47,9 +47,6 @@ grub_script_cmd_shift (grub_command_t cmd __attribute__((unused)), if (! scope) return GRUB_ERR_NONE; - if (scope->argv.argc == 0) - return GRUB_ERR_NONE; - if (argc == 0) n = 1; @@ -59,10 +56,13 @@ grub_script_cmd_shift (grub_command_t cmd __attribute__((unused)), else { n = grub_strtoul (argv[0], &p, 10); - if (*p != '\0' || n > scope->argv.argc) + if (*p != '\0') return GRUB_ERR_BAD_ARGUMENT; } + if (n > scope->argv.argc) + return GRUB_ERR_BAD_ARGUMENT; + scope->argv.argc -= n; scope->argv.args += n; return GRUB_ERR_NONE;