]> granicus.if.org Git - apache/commitdiff
Leaky as a sieve.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 6 Feb 2002 08:11:23 +0000 (08:11 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 6 Feb 2002 08:11:23 +0000 (08:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93280 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/mpm_winnt.c

index 17e539a2c08f1fecc1c8450256de6ec39c200333..56844de5c864327c7baefe0c9e58bb6f9f4ae26d 100644 (file)
@@ -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 */
     }