From 62d05aef8bd69351174a6d616cb152104a06400f Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Wed, 6 Feb 2002 08:11:23 +0000 Subject: [PATCH] Leaky as a sieve. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93280 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/winnt/mpm_winnt.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 17e539a2c0..56844de5c8 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1690,6 +1690,7 @@ static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_even /* Don't wait to verify that the child process really exits, * just move on with the restart. */ + CloseHandle(event_handles[CHILD_HANDLE]); event_handles[CHILD_HANDLE] = NULL; ++ap_my_generation; } @@ -1733,17 +1734,21 @@ die_now: ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), ap_server_conf, "Parent: SetEvent for child process %d failed", event_handles[CHILD_HANDLE]); } - rv = WaitForSingleObject(event_handles[CHILD_HANDLE], timeout); - if (rv == WAIT_OBJECT_0) { - ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO, APR_SUCCESS, ap_server_conf, - "Parent: Child process %d exited successfully.", event_handles[CHILD_HANDLE]); - event_handles[CHILD_HANDLE] = NULL; - } - else { - ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO, APR_SUCCESS, ap_server_conf, - "Parent: Forcing termination of child process %d ", event_handles[CHILD_HANDLE]); - TerminateProcess(event_handles[CHILD_HANDLE], 1); - event_handles[CHILD_HANDLE] = NULL; + if (event_handles[CHILD_HANDLE]) { + rv = WaitForSingleObject(event_handles[CHILD_HANDLE], timeout); + if (rv == WAIT_OBJECT_0) { + ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO, APR_SUCCESS, ap_server_conf, + "Parent: Child process %d exited successfully.", event_handles[CHILD_HANDLE]); + CloseHandle(event_handles[CHILD_HANDLE]); + event_handles[CHILD_HANDLE] = NULL; + } + else { + ap_log_error(APLOG_MARK,APLOG_INFO|APLOG_NOERRNO, APR_SUCCESS, ap_server_conf, + "Parent: Forcing termination of child process %d ", event_handles[CHILD_HANDLE]); + TerminateProcess(event_handles[CHILD_HANDLE], 1); + CloseHandle(event_handles[CHILD_HANDLE]); + event_handles[CHILD_HANDLE] = NULL; + } } return 0; /* Tell the caller we do not want to restart */ } -- 2.40.0