From e6ae006f6075f47e453ac2fe27d64d2945e7ab77 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 12 Feb 2006 04:57:13 +0000 Subject: [PATCH] Fix dangling pipe: we didn't close the child's ends of the pipes in the parent, so it kept a reference to the handles. (This didn't cause problems normally, but since the child's ends of the pipes remained open when it closed, it reduced reliability in failure cases.) --- stepmania/src/archutils/Win32/Crash.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/stepmania/src/archutils/Win32/Crash.cpp b/stepmania/src/archutils/Win32/Crash.cpp index 012d306ddf..3ea859ba87 100644 --- a/stepmania/src/archutils/Win32/Crash.cpp +++ b/stepmania/src/archutils/Win32/Crash.cpp @@ -122,7 +122,7 @@ bool StartChild( HANDLE &hProcess, HANDLE &hToStdin, HANDLE &hFromStdout ) strcat( szBuf, CHILD_MAGIC_PARAMETER ); PROCESS_INFORMATION pi; - if( !CreateProcess( + int iRet = CreateProcess( NULL, // pointer to name of executable module szBuf, // pointer to command line string NULL, // process security attributes @@ -133,8 +133,17 @@ bool StartChild( HANDLE &hProcess, HANDLE &hToStdin, HANDLE &hFromStdout ) cwd, // pointer to current directory name &si, // pointer to STARTUPINFO &pi // pointer to PROCESS_INFORMATION - ) ) + ); + + CloseHandle( si.hStdInput ); + CloseHandle( si.hStdOutput ); + + if( !iRet ) + { + CloseHandle( hToStdin ); + CloseHandle( hFromStdout ); return false; + } hProcess = pi.hProcess;