]> git.kaiwu.me - nginx.git/commitdiff
fix segfault when
authorIgor Sysoev <igor@sysoev.ru>
Wed, 18 Apr 2007 11:28:11 +0000 (11:28 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 18 Apr 2007 11:28:11 +0000 (11:28 +0000)
*) perl was built without multiplicity
*) when configuration was invalid

src/core/ngx_cycle.c
src/http/modules/perl/ngx_http_perl_module.c

index 243febd0e130fe4f5c2db4b79b6f4b8c0fa0136d..f900a2824b2aa152eb5bfaa21ffa556b665473ff 100644 (file)
@@ -54,11 +54,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
     ngx_list_part_t    *part, *opart;
     ngx_open_file_t    *file;
     ngx_listening_t    *ls, *nls;
-    ngx_core_conf_t    *ccf;
+    ngx_core_conf_t    *ccf, *old_ccf;
     ngx_core_module_t  *module;
-#if !(WIN32)
-    ngx_core_conf_t    *old_ccf;
-#endif
 
     log = old_cycle->log;
 
@@ -747,6 +744,14 @@ old_shm_zone_done:
 
 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 */
 
     part = &cycle->open_files.part;
index 3006a070c2831a1e872e9cd5dc68f9f8309e634c..b11320dad6643f5e4a96a0a7ea2ffc6e1b2643b9 100644 (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 (perl) {
+
+        if (ngx_set_environment(cf->cycle, NULL) == NULL) {
+            return NGX_CONF_ERROR;
+        }
+
         if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, cf->log)
             != NGX_OK)
         {