mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
restore environ for perl_destruct()
This commit is contained in:
parent
078dc8bc49
commit
7f35ae6ea6
@ -42,20 +42,21 @@ static ngx_str_t error_log = ngx_null_string;
|
|||||||
ngx_cycle_t *
|
ngx_cycle_t *
|
||||||
ngx_init_cycle(ngx_cycle_t *old_cycle)
|
ngx_init_cycle(ngx_cycle_t *old_cycle)
|
||||||
{
|
{
|
||||||
void *rv;
|
void *rv;
|
||||||
u_char *lock_file;
|
char **senv, **env;
|
||||||
ngx_uint_t i, n;
|
u_char *lock_file;
|
||||||
ngx_log_t *log;
|
ngx_uint_t i, n;
|
||||||
ngx_conf_t conf;
|
ngx_log_t *log;
|
||||||
ngx_pool_t *pool;
|
ngx_conf_t conf;
|
||||||
ngx_cycle_t *cycle, **old;
|
ngx_pool_t *pool;
|
||||||
ngx_shm_zone_t *shm_zone, *oshm_zone;
|
ngx_cycle_t *cycle, **old;
|
||||||
ngx_slab_pool_t *shpool;
|
ngx_shm_zone_t *shm_zone, *oshm_zone;
|
||||||
ngx_list_part_t *part, *opart;
|
ngx_slab_pool_t *shpool;
|
||||||
ngx_open_file_t *file;
|
ngx_list_part_t *part, *opart;
|
||||||
ngx_listening_t *ls, *nls;
|
ngx_open_file_t *file;
|
||||||
ngx_core_conf_t *ccf, *old_ccf;
|
ngx_listening_t *ls, *nls;
|
||||||
ngx_core_module_t *module;
|
ngx_core_conf_t *ccf, *old_ccf;
|
||||||
|
ngx_core_module_t *module;
|
||||||
|
|
||||||
log = old_cycle->log;
|
log = old_cycle->log;
|
||||||
|
|
||||||
@ -187,6 +188,9 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
senv = environ;
|
||||||
|
|
||||||
|
|
||||||
ngx_memzero(&conf, sizeof(ngx_conf_t));
|
ngx_memzero(&conf, sizeof(ngx_conf_t));
|
||||||
/* STUB: init array ? */
|
/* STUB: init array ? */
|
||||||
conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
|
conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
|
||||||
@ -694,9 +698,20 @@ old_shm_zone_done:
|
|||||||
|
|
||||||
if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
|
if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* perl_destruct() frees environ if it is not the same as it was at
|
||||||
|
* perl_construct() time. So we have saved an previous cycle
|
||||||
|
* environment before ngx_conf_parse() where it will be changed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
env = environ;
|
||||||
|
environ = senv;
|
||||||
|
|
||||||
ngx_destroy_pool(old_cycle->pool);
|
ngx_destroy_pool(old_cycle->pool);
|
||||||
cycle->old_cycle = NULL;
|
cycle->old_cycle = NULL;
|
||||||
|
|
||||||
|
environ = env;
|
||||||
|
|
||||||
return cycle;
|
return cycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user