Fixed bug which causes some commands to be masked

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-18 18:54:23 +01:00
parent 8fbfe0d68b
commit 024478a2d8

View file

@ -78,14 +78,22 @@ read_command_list (void)
if (file)
{
char *buf = NULL;
grub_command_t ptr, last = 0, next;
/* Override previous commands.lst. */
while (grub_command_list)
for (ptr = grub_command_list; ptr; ptr = next)
{
grub_command_t tmp;
tmp = grub_command_list->next;
grub_free (grub_command_list);
grub_command_list = tmp;
next = ptr->next;
if (ptr->func == grub_dyncmd_dispatcher)
{
if (last)
last->next = ptr->next;
else
grub_command_list = ptr->next;
grub_free (ptr);
}
else
last = ptr;
}
for (;; grub_free (buf))