From 8cbea60c02e18354bcd2b8603eef5a2a74ef9f15 Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Mon, 11 Feb 2002 15:46:44 +0000 Subject: [PATCH] Win32: Handles returned by GetStdHandle are psuedo handles and should never be passed to a CloseHandle call. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93361 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/winnt/mpm_winnt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 1a954bf137..d08c7447a7 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1600,7 +1600,12 @@ static int create_process(apr_pool_t *p, HANDLE *child_proc, HANDLE *child_exit_ CloseHandle(pi.hThread); CloseHandle(hPipeRead); CloseHandle(hNullOutput); - CloseHandle(hShareError); + if (GetStdHandle(STD_ERROR_HANDLE) != hShareError) { + /* Handles opened with GetStdHandle are psuedo handles + * and should not be closed else bad things will happen. + */ + CloseHandle(hShareError); + } _putenv("AP_PARENT_PID="); _putenv("AP_MY_GENERATION="); -- 2.40.0