From: Mike Yuan Date: Sat, 7 Sep 2024 19:27:20 +0000 (+0200) Subject: terminal-util: correct fd validity check X-Git-Tag: v257-rc1~516 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=978e7d166c362302ce2302ac36efe9717d642d90;p=thirdparty%2Fsystemd.git terminal-util: correct fd validity check Follow-up for 14f594b995bbaea85456a4c26e5c07446a4c446e --- 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