[PATCH 22 of 31] Cache: correctly set conf_file while adding paths

Maxim Dounin mdounin at mdounin.ru
Mon Jun 27 21:06:52 MSD 2011


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1309187312 -14400
# Node ID 6f91d11441c52bad0490f17afe1a5db2244762c4
# Parent  a36e93979fbdcf882ba8cfa3803ac55df10d2cc4
Cache: correctly set conf_file while adding paths.

Missing conf_file causes incorrect error messages in ngx_add_path() and may
lead to segmentation fault while reading configuration.

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -1651,6 +1651,8 @@ ngx_http_file_cache_set_slot(ngx_conf_t 
     cache->path->manager = ngx_http_file_cache_manager;
     cache->path->loader = ngx_http_file_cache_loader;
     cache->path->data = cache;
+    cache->path->conf_file = cf->conf_file->file.name.data;
+    cache->path->line = cf->conf_file->line;
 
     if (ngx_add_path(cf, &cache->path) != NGX_OK) {
         return NGX_CONF_ERROR;



More information about the nginx-devel mailing list