summaryrefslogtreecommitdiffstats
path: root/common/console_countdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/console_countdown.c')
-rw-r--r--common/console_countdown.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/common/console_countdown.c b/common/console_countdown.c
index 03b9b33538..36da1ce577 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -47,12 +47,14 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
do {
if (tstc()) {
key = getchar();
- if (flags & CONSOLE_COUNTDOWN_ANYKEY)
- goto out;
- if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
- goto out;
- if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
- goto out;
+ if (key >= 0) {
+ if (flags & CONSOLE_COUNTDOWN_ANYKEY)
+ goto out;
+ if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
+ goto out;
+ if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
+ goto out;
+ }
key = 0;
}
if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&