From 9b081d8893c4fce3451e3a5a4d5ac5a9960874ae Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Thu, 7 May 2015 21:29:19 +0300 Subject: [PATCH] menu: Return an error code if Ctrl-C is pressed Previously, if the menu activated by the 'sysboot' command gets interrupted by a Ctrl-C, the behaviour is as if the menu timeout was reached - i.e. boot the default menu entry. This patch fixes that so a Ctrl-C now terminates the command as the user would expect. Signed-off-by: Tuomas Tynkkynen Reviewed-by: Simon Glass --- common/menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/menu.c b/common/menu.c index e81c074f36..eda96d68bc 100644 --- a/common/menu.c +++ b/common/menu.c @@ -202,6 +202,9 @@ static inline int menu_interactive_choice(struct menu *m, void **choice) choice_item = menu_item_by_key(m, cbuf); if (!choice_item) printf("%s not found\n", cbuf); + } else if (readret == -1) { + printf("\n"); + return -EINTR; } else { return menu_default_choice(m, choice); }