# HG changeset patch # User Igor Sysoev # Date 1253265674 0 # Node ID 959fa3a11b030133cd946dc7e868fe39911e37cb # Parent cbee9c1145042788e74ba59efa7e9f2a902994b3 restore environ, this fixes segfault on reconfiguration failure when perl module creates new environment diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -255,11 +255,13 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) #endif if (ngx_conf_param(&conf) != NGX_CONF_OK) { + environ = senv; ngx_destroy_cycle_pools(&conf); return NULL; } if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) { + environ = senv; ngx_destroy_cycle_pools(&conf); return NULL; } @@ -280,6 +282,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index]) == NGX_CONF_ERROR) { + environ = senv; ngx_destroy_cycle_pools(&conf); return NULL; }