diff src/core/ngx_conf_file.c @ 324:f7cd062ee035 NGINX_0_6_6

nginx 0.6.6 *) Feature: the --sysconfdir=PATH option in configure. *) Feature: named locations. *) Feature: the $args variable can be set with the "set" directive. *) Feature: the $is_args variable. *) Bugfix: fair big weight upstream balancer. *) Bugfix: if a client has closed connection to mail proxy then nginx might not close connection to backend. *) Bugfix: if the same host without specified port was used as backend for HTTP and HTTPS, then nginx used only one port - 80 or 443. *) Bugfix: fix building on Solaris/amd64 by Sun Studio 11 and early versions; bug appeared in 0.6.4.
author Igor Sysoev <http://sysoev.ru>
date Mon, 30 Jul 2007 00:00:00 +0400
parents 94e16de3c33f
children 3a91bfeffaba
line wrap: on
line diff
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -641,7 +641,7 @@ ngx_conf_include(ngx_conf_t *cf, ngx_com
 
     ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
 
-    if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR) {
+    if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR) {
         return NGX_CONF_ERROR;
     }
 
@@ -681,9 +681,10 @@ ngx_conf_include(ngx_conf_t *cf, ngx_com
 
 
 ngx_int_t
-ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name)
+ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
 {
-    u_char     *p;
+    size_t      len;
+    u_char     *p, *prefix;
     ngx_str_t   old;
 
     if (name->data[0] == '/') {
@@ -704,14 +705,22 @@ ngx_conf_full_name(ngx_cycle_t *cycle, n
 
     old = *name;
 
-    name->len = cycle->root.len + old.len;
+    if (conf_prefix) {
+        len = sizeof(NGX_CONF_PREFIX) - 1;
+        prefix = (u_char *) NGX_CONF_PREFIX;
 
+    } else {
+        len = cycle->root.len;
+        prefix = cycle->root.data;
+    }
+
+    name->len = len + old.len;
     name->data = ngx_palloc(cycle->pool, name->len + 1);
     if (name->data == NULL) {
         return  NGX_ERROR;
     }
 
-    p = ngx_cpymem(name->data, cycle->root.data, cycle->root.len),
+    p = ngx_cpymem(name->data, prefix, len);
     ngx_cpystrn(p, old.data, old.len + 1);
 
     return NGX_OK;
@@ -734,7 +743,7 @@ ngx_conf_open_file(ngx_cycle_t *cycle, n
     if (name) {
         full = *name;
 
-        if (ngx_conf_full_name(cycle, &full) == NGX_ERROR) {
+        if (ngx_conf_full_name(cycle, &full, 0) == NGX_ERROR) {
             return NULL;
         }