fix segfault when

*) perl was built without multiplicity
*) when configuration was invalid
This commit is contained in:
Igor Sysoev 2007-04-18 11:28:11 +00:00
parent 342df6886d
commit ed3c703f4a
2 changed files with 14 additions and 4 deletions

View file

@ -54,11 +54,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
ngx_list_part_t *part, *opart; ngx_list_part_t *part, *opart;
ngx_open_file_t *file; ngx_open_file_t *file;
ngx_listening_t *ls, *nls; ngx_listening_t *ls, *nls;
ngx_core_conf_t *ccf; ngx_core_conf_t *ccf, *old_ccf;
ngx_core_module_t *module; ngx_core_module_t *module;
#if !(WIN32)
ngx_core_conf_t *old_ccf;
#endif
log = old_cycle->log; log = old_cycle->log;
@ -747,6 +744,14 @@ old_shm_zone_done:
failed: failed:
if (!ngx_is_init_cycle(old_cycle)) {
old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
ngx_core_module);
if (old_ccf->environment) {
environ = old_ccf->environment;
}
}
/* rollback the new cycle configuration */ /* rollback the new cycle configuration */
part = &cycle->open_files.part; part = &cycle->open_files.part;

View file

@ -459,6 +459,11 @@ ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
#if !(NGX_HAVE_PERL_MULTIPLICITY) #if !(NGX_HAVE_PERL_MULTIPLICITY)
if (perl) { if (perl) {
if (ngx_set_environment(cf->cycle, NULL) == NULL) {
return NGX_CONF_ERROR;
}
if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, cf->log) if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, cf->log)
!= NGX_OK) != NGX_OK)
{ {