summaryrefslogtreecommitdiff
path: root/memory/unix/apr_pools.c
diff options
context:
space:
mode:
authorBranko Čibej <brane@apache.org>2015-04-24 22:54:24 +0000
committerBranko Čibej <brane@apache.org>2015-04-24 22:54:24 +0000
commit8c3422e7299173cf6d2a8835fd3caa458aae0564 (patch)
tree0f0c2b78210e79239b014d65f687a32392671593 /memory/unix/apr_pools.c
parent4d54f2559bc8523119d901bce0a7fcd414a1ed47 (diff)
downloadapr-8c3422e7299173cf6d2a8835fd3caa458aae0564.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1675970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory/unix/apr_pools.c')
-rw-r--r--memory/unix/apr_pools.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index b6660cc9a..6d02e1bdc 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -603,6 +603,12 @@ static apr_allocator_t *global_allocator = NULL;
#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_initialize(void)
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