diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-01-25 21:48:28 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-01-25 21:48:28 +0000 |
commit | 95ec258be3e057b6accb58c01e181ed586692538 (patch) | |
tree | 7b709fbf7534b4a8062ca7fd20a13fa924509d26 /src/core/nginx.c | |
parent | 5f8e7365a1fa9d521cd8e10e1ae01ae7ff341c05 (diff) | |
download | nginx-95ec258be3e057b6accb58c01e181ed586692538.tar.gz nginx-95ec258be3e057b6accb58c01e181ed586692538.zip |
fix online upgrade
Diffstat (limited to 'src/core/nginx.c')
-rw-r--r-- | src/core/nginx.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index c251ff56a..357b1b9cd 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -423,15 +423,8 @@ ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last) ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); - if (last) { - n = *last; - - } else { - if (ccf->environment) { - return ccf->environment; - } - - n = 0; + if (last == NULL && ccf->environment) { + return ccf->environment; } var = ccf->env.elts; @@ -453,6 +446,8 @@ ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last) tz_found: + n = 0; + for (i = 0; i < ccf->env.nelts; i++) { if (var[i].data[var[i].len] == '=') { @@ -472,8 +467,8 @@ tz_found: } if (last) { + env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log); *last = n; - env = ngx_alloc((n + 1) * sizeof(char *), cycle->log); } else { env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *)); |