]> granicus.if.org Git - apache/commitdiff
Moved the call to apr_mmap_dup outside the error branch so
authorPaul J. Reder <rederpj@apache.org>
Fri, 19 Apr 2002 19:16:23 +0000 (19:16 +0000)
committerPaul J. Reder <rederpj@apache.org>
Fri, 19 Apr 2002 19:16:23 +0000 (19:16 +0000)
 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
modules/cache/mod_file_cache.c

diff --git a/CHANGES b/CHANGES
index 570b88d158d13b31fd309c81a1f025b3d6b1e536..ef326c14804dc4b0fabb3b3d99dfeef56137c5a0 100644 (file)
--- 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
index c16d4bf724b78934f0f60c4081e95d3b5d428306..ef172dd5ecd7640c3f6088d6466eb69aa02f8adc 100644 (file)
@@ -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