summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-05-02 11:16:00 +0000
committerYann Ylavic <ylavic@apache.org>2018-05-02 11:16:00 +0000
commitf5c6ef494e0cc977181c9033b1e17e96ebe9922e (patch)
tree0973b19de8074300eb7e40615ccac38f53c4b03b /os
parent77fd5a37b6c2a001f010ab0239bf3e538c6d52d9 (diff)
downloadhttpd-f5c6ef494e0cc977181c9033b1e17e96ebe9922e.tar.gz
Follow up to r1822537: replace static variable with pool userdata.
Also adds a comment and a CHANGES entry. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1830744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'os')
-rw-r--r--os/unix/unixd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/os/unix/unixd.c b/os/unix/unixd.c
index 196f67bace..bde859022b 100644
--- a/os/unix/unixd.c
+++ b/os/unix/unixd.c
@@ -532,12 +532,15 @@ AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool_t *pconf, int one_process)
if (!one_process) {
ap_fatal_signal_setup(ap_server_conf, pconf);
}
- else {
- static int once = 0;
- if (!once) {
- atexit(ap_terminate);
- once = 1;
- }
+ else if (!ap_retained_data_get("ap_unixd_mpm_one_process_cleanup")) {
+ /* In one process mode (debug), httpd will exit immediately when asked
+ * to (SIGTERM/SIGINT) and never restart. We still want the cleanups to
+ * run though (such that e.g. temporary files/IPCs don't leak on the
+ * system), so the first time around we use atexit() to cleanup after
+ * ourselves.
+ */
+ ap_retained_data_create("ap_unixd_mpm_one_process_cleanup", 1);
+ atexit(ap_terminate);
}
/* Signals' handlers depend on retained data */