[PATCH v10 1/2] cmdline: handle EOF in cmdline_poll
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 30 21:09:13 CET 2023
If end of file is reached on input, then cmdline_read_char()
will return 0. The problem is that cmdline_poll() was not checking
for this and would continue and not return the status.
Fixes: 9251cd97a6be ("cmdline: add internal wrappers for character input")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/cmdline/cmdline.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/cmdline/cmdline.c b/lib/cmdline/cmdline.c
index e1009ba4c413..de41406d61e0 100644
--- a/lib/cmdline/cmdline.c
+++ b/lib/cmdline/cmdline.c
@@ -194,7 +194,7 @@ cmdline_poll(struct cmdline *cl)
else if (status > 0) {
c = -1;
read_status = cmdline_read_char(cl, &c);
- if (read_status < 0)
+ if (read_status <= 0)
return read_status;
status = cmdline_in(cl, &c, 1);
--
2.39.0
More information about the dev
mailing list