]> granicus.if.org Git - apache/commitdiff
Follow up to r1822537: replace static variable with pool userdata.
authorYann Ylavic <ylavic@apache.org>
Wed, 2 May 2018 11:16:00 +0000 (11:16 +0000)
committerYann Ylavic <ylavic@apache.org>
Wed, 2 May 2018 11:16:00 +0000 (11:16 +0000)
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

CHANGES
os/unix/unixd.c

diff --git a/CHANGES b/CHANGES
index 09343fa05e32f9bfd24ef7aded7824d7219af43e..f55f0feea63d800f1ca3e33b25101dbc03084277 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) core: In ONE_PROCESS/debug mode, cleanup everything when exiting.
+     [Yann Ylavic]
+
   *) mod_http2: restoring the v1.10.16 keepalive timeout behavioud of mod_http2 (to be verified).
      [Stefan Eissing]
 
index 196f67bace88c1651d562223602217a56573f413..bde859022bd65a6f3db78321040f268b1447c2df 100644 (file)
@@ -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 */