Skip to content

Commit 50ef0a3

Browse files
committed
Permit close to failure with EBADF
Closing an already closed FD is OK and should not cause failures.
1 parent 5d3ff7c commit 50ef0a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cbits/posix/fork_exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ setup_std_handle_fork(int fd,
6464
{
6565
switch (b->behavior) {
6666
case STD_HANDLE_CLOSE:
67-
if (close(fd) == -1) {
67+
if (close(fd) == -1 && errno != EBADF) {
6868
child_failed(pipe, "close");
6969
}
7070
return 0;

0 commit comments

Comments
 (0)