From 6150feda56193e2b228fe893fcf79980d8586bf4 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 25 Oct 2012 12:49:30 +0200 Subject: [PATCH] =?UTF-8?q?unix:=20fix=20=E2=80=98fd=E2=80=99=20undeclared?= =?UTF-8?q?=20build=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reapplies commit b5028c5b, failed to merge in 5cb4197. --- src/unix/process.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/unix/process.c b/src/unix/process.c index 25b4d5d8b..d67d00264 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -289,24 +289,24 @@ static void uv__process_child_init(uv_process_options_t options, int error_fd) { int close_fd; int use_fd; - int i; + int fd; if (options.flags & UV_PROCESS_DETACHED) setsid(); - for (i = 0; i < stdio_count; i++) { - close_fd = pipes[i][0]; - use_fd = pipes[i][1]; + for (fd = 0; fd < stdio_count; fd++) { + close_fd = pipes[fd][0]; + use_fd = pipes[fd][1]; if (use_fd >= 0) close(close_fd); - else if (i >= 3) + else if (fd >= 3) continue; else { /* redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is * set */ - use_fd = open("/dev/null", i == 0 ? O_RDONLY : O_RDWR); + use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR); if (use_fd == -1) { uv__write_int(error_fd, errno); @@ -315,10 +315,10 @@ static void uv__process_child_init(uv_process_options_t options, } } - if (i == use_fd) + if (fd == use_fd) uv__cloexec(use_fd, 0); else { - dup2(use_fd, i); + dup2(use_fd, fd); close(use_fd); }