Skip to content

Commit

Permalink
unix: don't close the fds we just setup
Browse files Browse the repository at this point in the history
If a descriptor was being copied to an fd that *was not its current
value*, it should get closed after being copied. But the existing code
would close the fd, even when it no longer referred to the original
descriptor. Don't do this, only close fds that are not in the desired
range for the child process.

See nodejs/node#862
  • Loading branch information
sam-github authored and saghul committed Mar 20, 2015
1 parent 3616e61 commit af4a546
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/unix/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ static void uv__process_child_init(const uv_process_options_t* options,
for (fd = 0; fd < stdio_count; fd++) {
use_fd = pipes[fd][1];

if (use_fd >= 0 && fd != use_fd)
if (use_fd >= stdio_count)
close(use_fd);
}

Expand Down

0 comments on commit af4a546

Please sign in to comment.