aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuomas Tynkkynen2015-05-07 21:29:19 +0300
committerTom Rini2015-05-27 13:35:54 -0400
commit9b081d8893c4fce3451e3a5a4d5ac5a9960874ae (patch)
tree2897e65ab1e353a66bf4a5cb7d2ab42f6db0674f
parent0ece6b50f153fe2d349f4d26b18de4b0a3273537 (diff)
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>
-rw-r--r--common/menu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/menu.c b/common/menu.c
index e81c074f36c..eda96d68bc5 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);
}