diff options
author | FRIGN <dev@frign.de> | 2014-09-18 22:27:51 +0200 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-09-19 10:10:20 +0100 |
commit | dd4665bfbd4d5255d3671a7a41afb5afdf179576 (patch) | |
tree | 6bf86a63f844ec81059a023c662ea7118ce6320e /readpassphrase.c | |
parent | 12194aceff061d9fdb2c90cfeac9a9283569d5b0 (diff) |
Change global in-fifos from O_RDWR to O_RDONLY
O_RDWR is a dirty hack to get around the issue of infinite
EOFs while reading an in-FIFO.
Instead, stop breaking POSIX and set the FIFOs to O_RDONLY.
In case a read returns EOF (r == 0), we reopen the fd.
Same will be applied to the friend-fifos (especially file_in),
helping us get rid of strange timeouts and heuristics and
rather solve the problem the POSIX-way.
The only downside to this is that we are blind for writes
to the in-FIFOs between catching read == 0 and close(), but this is
not an issue.
To make reopening as easy as possible, I added a dirfd
to all slots.
While at it, I changed the initial setup and removed the chdir()
in favor of the POSIX-2008-compliant *at-functions.
This lets us do stuff without having to use snprintf to build
paths and is more bulletproof even in case the directory is
renamed.
Diffstat (limited to 'readpassphrase.c')
0 files changed, 0 insertions, 0 deletions