]> git.kaiwu.me - nginx.git/commitdiff
Perl: removed special environment handling for the perl module.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 7 Dec 2016 16:03:26 +0000 (19:03 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 7 Dec 2016 16:03:26 +0000 (19:03 +0300)
In Perl 5.8.6 the default was switched to use putenv() when used as
embedded library unless "PL_use_safe_putenv = 0" is explicitly used
in the code.  Therefore, for modern versions of Perl it is no longer
necessary to restore previous environment when calling perl_destruct().

auto/lib/perl/conf
src/core/ngx_cycle.c

index d891d821acdbf54742ed6f091f79e7e0e49c5205..e16a1bc85a1069ccfa848ac30d6a16fe85d7aeb2 100644 (file)
@@ -12,9 +12,9 @@ NGX_PERL_VER=`$NGX_PERL -v 2>&1 | grep '^This is perl' 2>&1 \
 if test -n "$NGX_PERL_VER"; then
     echo " + perl version: $NGX_PERL_VER"
 
-    if [ "`$NGX_PERL -e 'use 5.006001; print "OK"'`" != "OK" ]; then
+    if [ "`$NGX_PERL -e 'use 5.008006; print "OK"'`" != "OK" ]; then
         echo
-        echo "$0: error: perl 5.6.1 or higher is required"
+        echo "$0: error: perl 5.8.6 or higher is required"
         echo
 
         exit 1;
@@ -76,7 +76,7 @@ if test -n "$NGX_PERL_VER"; then
 
 else
     echo
-    echo "$0: error: perl 5.6.1 or higher is required"
+    echo "$0: error: perl 5.8.6 or higher is required"
     echo
 
     exit 1;
index a57991c69abac516bb16537954234187fd276a43..5e95628bfd97575a6f408fa4de707ed57784ab5b 100644 (file)
@@ -37,7 +37,7 @@ ngx_cycle_t *
 ngx_init_cycle(ngx_cycle_t *old_cycle)
 {
     void                *rv;
-    char               **senv, **env;
+    char               **senv;
     ngx_uint_t           i, n;
     ngx_log_t           *log;
     ngx_time_t          *tp;
@@ -750,20 +750,9 @@ old_shm_zone_done:
 
     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, therefore we save the previous cycle
-         * environment before ngx_conf_parse() where it will be changed.
-         */
-
-        env = environ;
-        environ = senv;
-
         ngx_destroy_pool(old_cycle->pool);
         cycle->old_cycle = NULL;
 
-        environ = env;
-
         return cycle;
     }