From 0e644e3340d25a649e6f0448097f4776b87f50e8 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 27 Feb 2011 16:23:13 +0100 Subject: [PATCH] Use dup2() instead of dup() when executing child processes (more portable, due to use of STD*_FILENO?) --- src/c/unixsys.d | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/c/unixsys.d b/src/c/unixsys.d index c8a434999..af095770a 100755 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -549,14 +549,11 @@ make_windows_handle(HANDLE h) /* Child */ int j; void **argv_ptr = (void **)argv->vector.self.t; - close(0); - dup(child_stdin); + dup2(child_stdin, STDIN_FILENO); if (parent_write) close(parent_write); - close(1); - dup(child_stdout); + dup2(child_stdout, STDOUT_FILENO); if (parent_read) close(parent_read); - close(2); - dup(child_stderr); + dup2(child_stderr, STDERR_FILENO); for (j = 0; j < argv->vector.fillp; j++) { cl_object arg = argv->vector.self.t[j]; if (arg == Cnil) {