[PATCH] console_countdown: Add CR as valid return key

Jules Maselbas jmaselbas at kalray.eu
Thu Jul 16 09:27:53 EDT 2020


Now both LF ('\n') and CR ('\r') are valid keys to abort
console_countdown when using CONSOLE_COUNTDOWN_RETURN flag.

Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
---
 common/console_countdown.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/console_countdown.c b/common/console_countdown.c
index 74dc38279..b92948f50 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -64,7 +64,7 @@ int console_countdown(int timeout_s, unsigned flags, const char *keys,
 					goto out;
 				if (flags & CONSOLE_COUNTDOWN_ANYKEY)
 					goto out;
-				if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
+				if (flags & CONSOLE_COUNTDOWN_RETURN && (key == '\n' || key == '\r'))
 					goto out;
 				if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
 					goto out;
-- 
2.17.1




More information about the barebox mailing list