flock: Close fd early for correct error propagation
Spotted by FRIGN.
This commit is contained in:
parent
e40fc2b176
commit
0c3440253b
6
flock.c
6
flock.c
@ -69,13 +69,13 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
waitpid(pid, &status, 0);
|
waitpid(pid, &status, 0);
|
||||||
|
|
||||||
|
if (close(fd) < 0)
|
||||||
|
eprintf("close:");
|
||||||
|
|
||||||
if (WIFSIGNALED(status))
|
if (WIFSIGNALED(status))
|
||||||
return 128 + WTERMSIG(status);
|
return 128 + WTERMSIG(status);
|
||||||
if (WIFEXITED(status))
|
if (WIFEXITED(status))
|
||||||
return WEXITSTATUS(status);
|
return WEXITSTATUS(status);
|
||||||
|
|
||||||
if (close(fd) < 0)
|
|
||||||
eprintf("close:");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user