From 1c2f22c475aedf94ab8fae175f4b3f0a4e12d45b Mon Sep 17 00:00:00 2001 From: "Paul J. Reder" Date: Fri, 19 Apr 2002 19:16:23 +0000 Subject: [PATCH] Moved the call to apr_mmap_dup outside the error branch so that it would actually get called. This fixes a core dump at init everytime you use the MMapFile directive. [Paul J. Reder] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94721 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/cache/mod_file_cache.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 570b88d158..ef326c1480 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,7 @@ Changes with Apache 2.0.36 + *) Moved the call to apr_mmap_dup outside the error branch so + that it would actually get called. This fixes a core dump + at init everytime you use the MMapFile directive. [Paul J. Reder] *) Trigger an error when a LoadModule directive attempts to load a module which is built-in. This is a common error when diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index c16d4bf724..ef172dd5ec 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -244,20 +244,20 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap) (apr_size_t)new_file->finfo.size, APR_MMAP_READ, cmd->pool)) != APR_SUCCESS) { apr_file_close(fd); - /* We want to cache an apr_mmap_t that's marked as "non-owner" - * to pass to each request so that mmap_setaside()'s call to - * apr_mmap_dup() will never try to move the apr_mmap_t to a - * different pool. This apr_mmap_t is already going to live - * longer than any request, but mmap_setaside() has no way to - * know that because it's allocated out of cmd->pool, - * which is disjoint from r->pool. - */ - apr_mmap_dup(&new_file->mm, mm, cmd->pool, 0); ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, "mod_file_cache: unable to mmap %s, skipping", filename); return; } apr_file_close(fd); + /* We want to cache an apr_mmap_t that's marked as "non-owner" + * to pass to each request so that mmap_setaside()'s call to + * apr_mmap_dup() will never try to move the apr_mmap_t to a + * different pool. This apr_mmap_t is already going to live + * longer than any request, but mmap_setaside() has no way to + * know that because it's allocated out of cmd->pool, + * which is disjoint from r->pool. + */ + apr_mmap_dup(&new_file->mm, mm, cmd->pool, 0); new_file->is_mmapped = TRUE; } #endif -- 2.40.0