From 978e7d166c362302ce2302ac36efe9717d642d90 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 7 Sep 2024 21:27:20 +0200 Subject: [PATCH] terminal-util: correct fd validity check Follow-up for 14f594b995bbaea85456a4c26e5c07446a4c446e --- src/basic/terminal-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index a97312c9bf4..94720c9adf2 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -146,7 +146,7 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { } } - if (t != USEC_INFINITY && fd > 0) { + if (t != USEC_INFINITY && fd >= 0) { /* Let's wait the specified amount of time for input. When we have no fd we skip this, under * the assumption that this is an fmemopen() stream or so where waiting doesn't make sense * anyway, as the data is either already in the stream or cannot possible be placed there -- 2.47.3