]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Added a clean up on exit routine to try to make sure that the ApacheC nlm
authorBradley Nicholes <bnicholes@apache.org>
Wed, 23 May 2001 16:57:14 +0000 (16:57 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Wed, 23 May 2001 16:57:14 +0000 (16:57 +0000)
on NetWare is exited gracefully even on an abnormal shutdown.  This fixes
the Ouch! out of memory problem when trying to restart Apache for NetWare
after an abnormal shutdown.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@89224 13f79535-47bb-0310-9956-ffa450edef68

src/main/http_main.c

index 8176d821b9764f34077b57e9d8ccd162eabb5f22..63792e33f882badc3b99bac700c785da3e757783 100644 (file)
@@ -2213,6 +2213,19 @@ static ap_inline void put_scoreboard_info(int child_num,
 
 /* a clean exit from the parent with proper cleanup */
 #ifdef NETWARE
+void clean_shutdown_on_exit(void)
+{
+    if (!ap_main_finished) {
+        AMCSocketCleanup();
+        ap_destroy_pool(pcommands);    
+        free(ap_loaded_modules);    
+        ap_cleanup_method_ptrs();    
+        ap_destroy_pool(pglobal);
+        ap_cleanup_alloc();
+        ap_main_finished = TRUE;
+    }
+}
+
 void clean_parent_exit(int code) __attribute__((noreturn));
 void clean_parent_exit(int code)
 #else
@@ -6697,8 +6710,12 @@ int REALMAIN(int argc, char *argv[])
 #endif
 
 #ifdef NETWARE
+    // If top_module is not NULL then APACHEC was not exited cleanly
+    //  and is in a bad state.  Simply clean up and exit.
+    check_clean_load (top_module);
     init_name_space();
     signal(SIGTERM, signal_handler);
+    atexit(clean_shutdown_on_exit);
     init_tsd();
 #endif