From f18088844f5d5973801bb17f5545e2c9150cd9fa Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 17 Nov 2010 08:41:18 +0100 Subject: [PATCH] Make legacy_source behave like source. * grub-core/commands/legacycfg.c (legacy_file): Don't call grub_show_menu. (grub_cmd_legacy_source): Call grub_show_menu if needed. --- ChangeLog | 8 ++++++++ grub-core/commands/legacycfg.c | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42489cab7..3dc2e06da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-11-16 Vladimir Serbinenko + + Make legacy_source behave like source. + + * grub-core/commands/legacycfg.c (legacy_file): Don't call + grub_show_menu. + (grub_cmd_legacy_source): Call grub_show_menu if needed. + 2010-11-16 Colin Watson * conf/Makefile.common (CFLAGS_GNULIB): Add -Wno-unused-parameter. diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c index d5441db06..80718196a 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -177,9 +177,6 @@ legacy_file (const char *filename) grub_free (suffix); grub_free (entrysrc); - if (menu && menu->size) - grub_show_menu (menu, 1); - return GRUB_ERR_NONE; } @@ -194,8 +191,8 @@ grub_cmd_legacy_source (struct grub_command *cmd, return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required"); extractor = (cmd->name[0] == 'e'); - new_env = (cmd->name[extractor ? sizeof ("extract_legacy_entries_") - 1 - : sizeof ("legacy_") - 1] == 'c'); + new_env = (cmd->name[extractor ? (sizeof ("extract_legacy_entries_") - 1) + : (sizeof ("legacy_") - 1)] == 'c'); if (new_env) grub_cls (); @@ -207,8 +204,15 @@ grub_cmd_legacy_source (struct grub_command *cmd, ret = legacy_file (args[0]); - if (new_env && !extractor) - grub_env_context_close (); + if (new_env) + { + grub_menu_t menu; + menu = grub_env_get_menu (); + if (menu && menu->size) + grub_show_menu (menu, 1); + if (!extractor) + grub_env_context_close (); + } if (extractor) grub_env_extractor_close (!new_env);