sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit af2de02b5e79a28d2633480ec18ed0bc1abb9479
parent bfc62285347fc4c7bc0f6f241089a2fed1aad961
Author: sin <sin@2f30.org>
Date:   Mon Dec 21 14:11:07 +0000

flock: Close fd early for correct error propagation

Spotted by FRIGN.

Diffstat:
flock.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/flock.c b/flock.c @@ -69,13 +69,13 @@ main(int argc, char *argv[]) } waitpid(pid, &status, 0); + if (close(fd) < 0) + eprintf("close:"); + if (WIFSIGNALED(status)) return 128 + WTERMSIG(status); if (WIFEXITED(status)) return WEXITSTATUS(status); - if (close(fd) < 0) - eprintf("close:"); - return 0; }