Before waiting user key input to stop autoboot, the input buffer
must be flushed.

Signed-off-by: Masahisa Kojima <masahisa.koj...@linaro.org>
---
Change in v5:
- newly created, split into separate patch

 cmd/bootmenu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index d573487272..9a32a18b19 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -87,6 +87,10 @@ static void bootmenu_autoboot_loop(struct bootmenu_data 
*menu,
        int i, c;
 
        if (menu->delay > 0) {
+               /* flush input */
+               while (tstc())
+                       getchar();
+
                printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
                printf("  Hit any key to stop autoboot: %2d ", menu->delay);
        }
-- 
2.17.1

Reply via email to