summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-05-07 18:29:19 (GMT)
committerTom Rini <trini@konsulko.com>2015-05-27 17:35:54 (GMT)
commit9b081d8893c4fce3451e3a5a4d5ac5a9960874ae (patch)
tree2897e65ab1e353a66bf4a5cb7d2ab42f6db0674f /common
parent0ece6b50f153fe2d349f4d26b18de4b0a3273537 (diff)
downloadu-boot-9b081d8893c4fce3451e3a5a4d5ac5a9960874ae.tar.xz
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 <tuomas.tynkkynen@iki.fi> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/menu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/menu.c b/common/menu.c
index e81c074..eda96d6 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("<INTERRUPT>\n");
+ return -EINTR;
} else {
return menu_default_choice(m, choice);
}