From d64e64ecd60cadb2dbda547f35cd5a88c8fcad21 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Sat, 05 Jul 2008 00:46:42 +0000
Subject: [PATCH] Fix for issue 3461 (winlauncher should not inherit handlers from parent process)

---
 opends/src/build-tools/windows/common.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/opends/src/build-tools/windows/common.c b/opends/src/build-tools/windows/common.c
index 2917d88..3974748 100644
--- a/opends/src/build-tools/windows/common.c
+++ b/opends/src/build-tools/windows/common.c
@@ -52,6 +52,9 @@
   BOOL createOk;
   STARTUPINFO startInfo; // info to pass to the new process
   DWORD processFlag; // background process flag
+  HANDLE hStdin;                  /* stdin */
+  HANDLE hStdout;                 /* stdout */
+  HANDLE hStderr;                 /* stderr */
 
   debug("Attempting to create child process '%s' background=%d.", command,
       background);
@@ -63,6 +66,13 @@
   ZeroMemory(&startInfo, sizeof(STARTUPINFO));
   startInfo.cb = sizeof(STARTUPINFO);
   startInfo.dwFlags |= STARTF_USESTDHANDLES;  // use handles above
+  
+  hStdin= GetStdHandle(STD_INPUT_HANDLE);
+  SetHandleInformation (hStdin,  HANDLE_FLAG_INHERIT, FALSE);
+  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
+  SetHandleInformation (hStdout, HANDLE_FLAG_INHERIT, FALSE);
+  hStderr = GetStdHandle(STD_ERROR_HANDLE);
+  SetHandleInformation (hStderr, HANDLE_FLAG_INHERIT, FALSE);
 
   // Create the child process
   processFlag = background == TRUE ? DETACHED_PROCESS : 0;

--
Gitblit v1.10.0