fixed n > active_loops case
This commit is contained in:
parent
a7aa28248b
commit
8f6a910b23
2 changed files with 11 additions and 3 deletions
|
@ -281,6 +281,15 @@ grub_abs (int x)
|
|||
return (unsigned int) x;
|
||||
}
|
||||
|
||||
static inline long
|
||||
grub_min (long x, long y)
|
||||
{
|
||||
if (x < y)
|
||||
return x;
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
static inline long
|
||||
grub_max (long x, long y)
|
||||
{
|
||||
|
|
|
@ -44,12 +44,11 @@ grub_script_break (grub_command_t cmd __attribute__((unused)),
|
|||
if (argc == 0)
|
||||
count = 1;
|
||||
|
||||
else if ((argc > 1) ||
|
||||
(count = grub_strtoul (argv[0], &p, 10)) > active_loops ||
|
||||
else if ((argc > 1) || (count = grub_strtoul (argv[0], &p, 10)) == 0 ||
|
||||
(*p != '\0'))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad break");
|
||||
|
||||
active_breaks = count;
|
||||
active_breaks = grub_min (active_loops, count);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue