diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-21 21:03:24 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-26 12:33:58 +0000 |
commit | 4e140a59517f79bf593bec0f5a80810aa877f3ed (patch) | |
tree | 994d2cc793626f372397fc945bdd79b0ccbe56c7 | |
parent | 348ae6af01350a9a46f3076a2facd27918f0f603 (diff) | |
download | syslinux-4e140a59517f79bf593bec0f5a80810aa877f3ed.tar.gz syslinux-4e140a59517f79bf593bec0f5a80810aa877f3ed.tar.xz syslinux-4e140a59517f79bf593bec0f5a80810aa877f3ed.zip |
ldlinux: Never exit from ldlinux.c32
If there's no DEFAULT directive in the config file and the user hits
the ENTER key enough times, or we timeout waiting for input,
ldlinux.c32 will exit. This should never be allowed to happen, and we
need to keep doing the ldlinux_auto_boot()/boot prompt dance.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | com32/elflink/ldlinux/cli.c | 3 | ||||
-rw-r--r-- | com32/elflink/ldlinux/ldlinux.c | 49 | ||||
-rw-r--r-- | com32/include/cli.h | 2 |
3 files changed, 30 insertions, 24 deletions
diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c index ebeaeece..d876895c 100644 --- a/com32/elflink/ldlinux/cli.c +++ b/com32/elflink/ldlinux/cli.c @@ -119,7 +119,7 @@ static const char * cmd_reverse_search(int *cursor, clock_t *kbd_to, const char *edit_cmdline(const char *input, int top /*, int width */ , int (*pDraw_Menu) (int, int, int), - void (*show_fkey) (int)) + void (*show_fkey) (int), bool *timedout) { static char cmdline[MAX_CMDLINE_LEN]; char temp_cmdline[MAX_CMDLINE_LEN] = { }; @@ -202,6 +202,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , switch (key) { case KEY_NONE: /* We timed out. */ + *timedout = true; return NULL; case KEY_CTRL('L'): diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c index 59c55980..004769ce 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -206,26 +206,6 @@ bad_kernel: } } -static void enter_cmdline(void) -{ - const char *cmdline; - - /* Enter endless command line prompt, should support "exit" */ - while (1) { - cmdline = edit_cmdline("boot:", 1, NULL, cat_help_file); - printf("\n"); - - /* return if user only press enter or we timed out */ - if (!cmdline || cmdline[0] == '\0') { - if (ontimeoutlen) - load_kernel(ontimeout); - return; - } - - load_kernel(cmdline); - } -} - /* * If this function returns you must call ldinux_enter_command() to * preserve the 4.0x behaviour. @@ -241,10 +221,35 @@ void ldlinux_auto_boot(void) load_kernel(default_cmd); } +static void enter_cmdline(void) +{ + const char *cmdline; + + /* Enter endless command line prompt, should support "exit" */ + while (1) { + bool to = false; + + if (noescape) { + ldlinux_auto_boot(); + continue; + } + + cmdline = edit_cmdline("boot:", 1, NULL, cat_help_file, &to); + printf("\n"); + + /* return if user only press enter or we timed out */ + if (!cmdline || cmdline[0] == '\0') { + if (to && ontimeoutlen) + load_kernel(ontimeout); + else + ldlinux_auto_boot(); + } else + load_kernel(cmdline); + } +} + void ldlinux_enter_command(void) { - if (noescape) - ldlinux_auto_boot(); enter_cmdline(); } diff --git a/com32/include/cli.h b/com32/include/cli.h index 513c1719..eee4576f 100644 --- a/com32/include/cli.h +++ b/com32/include/cli.h @@ -14,7 +14,7 @@ extern void clear_screen(void); extern int mygetkey(clock_t timeout); extern const char *edit_cmdline(const char *input, int top /*, int width */ , int (*pDraw_Menu) (int, int, int), - void (*show_fkey) (int)); + void (*show_fkey) (int), bool *); extern struct menu *root_menu, *start_menu, *hide_menu, *menu_list, *default_menu; #endif |