diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-27 20:22:57 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-27 20:22:57 -0700 |
commit | d274b61cb59153cb705c7772527f1f43b89f2062 (patch) | |
tree | 0df2e132e31d988517c8d0d65c80474735da388c | |
parent | 824aca06ffbde70f86a72e474c051e0bf4474906 (diff) | |
download | pw-d274b61cb59153cb705c7772527f1f43b89f2062.tar.gz pw-d274b61cb59153cb705c7772527f1f43b89f2062.tar.bz2 pw-d274b61cb59153cb705c7772527f1f43b89f2062.zip |
Workaround: fix for issue reported by a user.
We are wrongly combining poll operations with buffered
reading from stdin. This means we call poll to wait for
input while ignoring data already buffered in the stdio
stream. When this happens at the end of a pipe, we
ignore the last bit forever.
The workaround is to switch stdin to unbuffered; but this
means that it issues one byte read operations (inefficient)
and risks blocking on partial lines.
Reported by konsolebox at gmail com.
-rw-r--r-- | pw.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -383,6 +383,7 @@ int main(int argc, char **argv) panic("unable to set TTY parameters"); setvbuf(tty, NULL, _IONBF, 0); + setvbuf(stdin, NULL, _IONBF, 0); for (unsigned stat = stat_dirty, hpos = 0, kbd_state = kbd_cmd, lasttime = ~0U; kbd_state != kbd_exit ;) |