From 2d4939c7a2c54f657df2b94a00949e5b8e1b3ebe Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 24 Feb 2015 13:17:48 -0800 Subject: [PATCH] unix: don't close the fds we just setup 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 https://github.com/iojs/io.js/issues/862 --- src/unix/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/process.c b/src/unix/process.c index 18d056e9e50..d212bc9bdbe 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -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); }