summaryrefslogtreecommitdiffstats
path: root/src/basic/terminal-util.c
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-09-07 21:27:20 +0200
committerMike Yuan <me@yhndnzj.com>2024-09-08 20:45:33 +0200
commit978e7d166c362302ce2302ac36efe9717d642d90 (patch)
tree81860d424f614389231f4162cb5b2b553c89d24f /src/basic/terminal-util.c
parentFix typo in escape.c (diff)
downloadsystemd-978e7d166c362302ce2302ac36efe9717d642d90.tar.xz
systemd-978e7d166c362302ce2302ac36efe9717d642d90.zip
terminal-util: correct fd validity check
Follow-up for 14f594b995bbaea85456a4c26e5c07446a4c446e
Diffstat (limited to 'src/basic/terminal-util.c')
-rw-r--r--src/basic/terminal-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index a97312c9bf..94720c9adf 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