Skip to contentSkip to conversation

don't display menu when there's nothing in it

PATCH In review Robert Millan 2 participants 3 messages Feb 1, 2008 – Feb 2, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 don't display menu when there's nothing in it

normal.mod seems to insist in displaying a menu even if grub.cfg didn't define any menu entries. This seems to be due to a bogus check (for menu instead of menu->size).

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)

* normal/main.c (grub_normal_execute): Check for menu->size' rather than menu' when determining whether menu has to be displayed.

normal/main.c renamed from grub2/normal/main.c +1 -1
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/normal/main.c ./normal/main.c
@@ -474,7 +474,7 @@ grub_normal_execute (const char *config,
       grub_errno = GRUB_ERR_NONE;
     }
 
-  if (menu)
+  if (menu->size)
     {
       grub_menu_run (menu, nested);
       if (nested)
#1 lore raw
Quoted 3 lines · Robert Millan

normal.mod seems to insist in displaying a menu even if grub.cfg didn't define any menu entries. This seems to be due to a bogus check (for menu instead of menu->size).

It is not completely bogus, since MENU can be NULL. Probably what you want is:

  if (menu && menu->size)

Okuji

#2 lore raw
Quoted 8 lines · Yoshinori K. Okuji
Quoted 3 lines · Robert Millan

normal.mod seems to insist in displaying a menu even if grub.cfg didn't define any menu entries. This seems to be due to a bogus check (for menu instead of menu->size).

It is not completely bogus, since MENU can be NULL. Probably what you want is:

  if (menu && menu->size)

Good catch. Committed.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)