sbase

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

commit 0c3440253bb7d7496eef18c1c115cba1f823bfb1
parent e40fc2b17676145087f62e66940d8aceccb793b5
Author: sin <sin@2f30.org>
Date:   Mon, 21 Dec 2015 14:11:07 +0000

flock: Close fd early for correct error propagation

Spotted by FRIGN.

Diffstat:
Mflock.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; }