flock: Close fd early for correct error propagation

Spotted by FRIGN.
This commit is contained in:
sin 2015-12-21 14:11:07 +00:00
parent e40fc2b176
commit 0c3440253b
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}