From: Bradley Nicholes Date: Wed, 23 May 2001 16:57:14 +0000 (+0000) Subject: Added a clean up on exit routine to try to make sure that the ApacheC nlm X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79ed54490514c7e1b931f8b1c2deaa0ab2dbec5c;p=thirdparty%2Fapache%2Fhttpd.git Added a clean up on exit routine to try to make sure that the ApacheC nlm 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 --- diff --git a/src/main/http_main.c b/src/main/http_main.c index 8176d821b97..63792e33f88 100644 --- a/src/main/http_main.c +++ b/src/main/http_main.c @@ -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