diff options
author | Érico Rolim <erico.erc@gmail.com> | 2020-10-21 18:52:51 -0300 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2020-12-02 00:11:51 +0000 |
commit | 82960d3c41601652860843c1040acaf7860d79d0 (patch) | |
tree | 2f195c6d263fdeb2b6d98b4950c72f4c0785b1b7 /AUTHORS | |
parent | 489421b9e763865881df614a3ef550b289409677 (diff) | |
download | imv-82960d3c41601652860843c1040acaf7860d79d0.tar.gz |
imv: don't rely on glibc's lack of FILE sync on exit.
This issue was spotted on musl, where killing imv with the Q shortcut
while it was waiting for image paths in stdin led to the application
hanging until stdin received an EOF manually with ^D, since the stdin
stream was locked by the fgets() function.
Switching to pipes and a helper thread allows us to use read() for
reading from STDIN_FILENO while still taking advantage of the fgets()
logic for handling newlines and buffer size. read() is a thread
cancellation point (fgets() is only an optional one), which makes it
possible to cancel the helper thread cleanly and force the thread using
fgets() to exit when the write-end of the pipe it's reading from is
closed.
Diffstat (limited to 'AUTHORS')
0 files changed, 0 insertions, 0 deletions