]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/nc-cui.c
ui/ncurses: only cancel default boot on valid key events
[petitboot] / ui / ncurses / nc-cui.c
index 5f5640975c2356b00d2d3a71a8585af5974ef54a..7200a81ae4bc5c5a87c5fe8437303751d5a3a033 100644 (file)
@@ -327,10 +327,6 @@ static int cui_process_key(void *arg)
 
        assert(cui->current);
 
-       if (!cui->has_input)
-               discover_client_cancel_default(cui->client);
-       cui->has_input = true;
-
        for (;;) {
                int c = getch();
 
@@ -339,6 +335,13 @@ static int cui_process_key(void *arg)
                if (c == ERR)
                        break;
 
+               if (!cui->has_input) {
+                       pb_log("UI input received (key = %d), aborting "
+                                       "default boot\n", c);
+                       discover_client_cancel_default(cui->client);
+                       cui->has_input = true;
+               }
+
                if (process_global_keys(cui, c))
                        continue;