This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't destroy the Unicode system environment on Perl startup
authorJan Dubois <jand@activestate.com>
Mon, 18 Dec 2006 16:34:33 +0000 (08:34 -0800)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 19 Dec 2006 09:49:30 +0000 (09:49 +0000)
Message-ID: <bsbeo2hama2sdo3kqdbrdhp505caeft6h9@4ax.com>

p4raw-id: //depot/perl@29590

perl.c

diff --git a/perl.c b/perl.c
index 4ad77af..7d0aeb0 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -4653,6 +4653,7 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
     }
     if ((PL_envgv = gv_fetchpvs("ENV", GV_ADD|GV_NOTQUAL, SVt_PVHV))) {
        HV *hv;
+       bool env_is_not_environ;
        GvMULTI_on(PL_envgv);
        hv = GvHVn(PL_envgv);
        hv_magic(hv, NULL, PERL_MAGIC_env);
@@ -4665,7 +4666,8 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
        */
        if (!env)
            env = environ;
-       if (env != environ
+       env_is_not_environ = env != environ;
+       if (env_is_not_environ
 #  ifdef USE_ITHREADS
            && PL_curinterp == aTHX
 #  endif
@@ -4687,7 +4689,7 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
 #endif
            sv = newSVpv(s+1, 0);
            (void)hv_store(hv, *env, s - *env, sv, 0);
-           if (env != environ)
+           if (env_is_not_environ)
                mg_set(sv);
            if (origenv != environ) {
              /* realloc has shifted us */