dgaudet 97/07/28 23:57:21
Modified: src http_main.c Log: Defensive coding -- protect against a possible future where while just_die() is in effect something might be muddling in alloc.c's internal structure, and one of the child_exit handlers may want to muddle there too. Revision Changes Path 1.191 +19 -8 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.190 retrieving revision 1.191 diff -u -r1.190 -r1.191 --- http_main.c 1997/07/28 18:22:47 1.190 +++ http_main.c 1997/07/29 06:57:19 1.191 @@ -216,6 +216,9 @@ int one_process = 0; +pool *pconf; /* Pool for config stuff */ +pool *ptrans; /* Pool for per-transaction stuff */ + /* small utility macros to make things easier to read */ #ifdef WIN32 @@ -375,6 +378,7 @@ static APACHE_TLS const char *timeout_name = NULL; static APACHE_TLS int alarms_blocked = 0; static APACHE_TLS int alarm_pending = 0; +static APACHE_TLS int exit_after_unblock = 0; #ifndef NO_USE_SIGACTION /* @@ -469,9 +473,14 @@ API_EXPORT(void) unblock_alarms() { --alarms_blocked; - if (alarms_blocked == 0 && alarm_pending) { - alarm_pending = 0; - timeout(0); + if (alarms_blocked == 0) { + if (exit_after_unblock) { + child_exit_modules(pconf, server_conf); + } + if (alarm_pending) { + alarm_pending = 0; + timeout(0); + } } } @@ -1475,15 +1484,17 @@ /***************************************************************** * Connection structures and accounting... - * Should these be global? Only to this file, at least... */ -pool *pconf; /* Pool for config stuff */ -pool *ptrans; /* Pool for per-transaction stuff */ - void just_die(int sig) /* SIGHUP to child process??? */ { - child_exit_modules(pconf, server_conf); + /* if alarms are blocked we have to wait to die otherwise we might + * end up with corruption in alloc.c's internal structures */ + if (alarms_blocked) { + exit_after_unblock = 1; + } else { + child_exit_modules(pconf, server_conf); + } } static int deferred_die;