apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1675970 - /apr/apr/trunk/memory/unix/apr_pools.c
Date Fri, 24 Apr 2015 22:54:24 GMT
Author: brane
Date: Fri Apr 24 22:54:24 2015
New Revision: 1675970

URL: http://svn.apache.org/r1675970
Log:
Follow up to r1675967: When pool debugging is enabled, make sure we
don't try to emit any debug events after the debug log file handle
has been closed.

Modified:
    apr/apr/trunk/memory/unix/apr_pools.c

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=1675970&r1=1675969&r2=1675970&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Fri Apr 24 22:54:24 2015
@@ -603,6 +603,12 @@ static apr_allocator_t *global_allocator
 
 #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 static apr_file_t *file_stderr = NULL;
+static apr_status_t apr_pool_cleanup_file_stderr(void *data)
+{
+    file_stderr = NULL;
+    return APR_SUCCESS;
+}
+
 #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 
 /*
@@ -1677,6 +1683,13 @@ APR_DECLARE(apr_status_t) apr_pool_initi
     file_stderr = debug_log;
 
     if (file_stderr) {
+        /* Add a cleanup handler that sets the debug log file handle
+         * to NULL, otherwise we'll try to log the global pool
+         * destruction event with predictably disastrous results. */
+        apr_pool_cleanup_register(global_pool, NULL,
+                                  apr_pool_cleanup_file_stderr,
+                                  apr_pool_cleanup_null);
+
         apr_file_printf(file_stderr,
             "POOL DEBUG: [PID"
 #if APR_HAS_THREADS



Mime
View raw message