terminal-util: correct fd validity check

Follow-up for 14f594b995
This commit is contained in:
Mike Yuan
2024-09-08 20:45:33 +02:00
parent 54ada3d13a
commit 978e7d166c
+1 -1
View File
@@ -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