summaryrefslogtreecommitdiff
path: root/memory
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2007-01-07 21:06:18 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2007-01-07 21:06:18 +0000
commitc5fcd6617286e84c4243912100681492c9084489 (patch)
treea6762675a2c58dd0b964218ed5f1dd5cc9545515 /memory
parent1141c0bf625645d98105fb55eb700a38c0884e33 (diff)
downloadlibapr-c5fcd6617286e84c4243912100681492c9084489.tar.gz
* memory/unix/apr_pools.c (apr_pool_initialize): Fix possible crash
with verbose debugging enabled. PR: 41063 Submitted by: Peter Steiner <peter.steiner+apache hugwi.ch> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@493838 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r--memory/unix/apr_pools.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index f327c67fb..9394e5d24 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -1233,6 +1233,7 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void)
apr_status_t rv;
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
char *logpath;
+ apr_file_t *debug_log = NULL;
#endif
if (apr_pools_initialized++)
@@ -1262,14 +1263,21 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void)
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool);
+ /* Don't pass file_stderr directly to apr_file_open() here, since
+ * apr_file_open() can call back to apr_pool_log_event() and that
+ * may attempt to use then then non-NULL but partially set up file
+ * object. */
if (rv == APR_SUCCESS) {
- apr_file_open(&file_stderr, logpath, APR_APPEND|APR_WRITE|APR_CREATE,
+ apr_file_open(&debug_log, logpath, APR_APPEND|APR_WRITE|APR_CREATE,
APR_OS_DEFAULT, global_pool);
}
else {
- apr_file_open_stderr(&file_stderr, global_pool);
+ apr_file_open_stderr(&debug_log, global_pool);
}
+ /* debug_log is now a file handle. */
+ file_stderr = debug_log;
+
if (file_stderr) {
apr_file_printf(file_stderr,
"POOL DEBUG: [PID"