diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2002-05-02 15:44:48 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2002-05-02 15:44:48 +0000 |
commit | 4efc5df63c21e7be3ddafb142377fe2511926c04 (patch) | |
tree | ab27aa859fec026d0dcbf95d8dd5ab4a03f08f06 /mg.c | |
parent | 2fc614e01c5e692def72089696c0a1da4f6f3833 (diff) | |
download | perl-4efc5df63c21e7be3ddafb142377fe2511926c04.tar.gz |
manual integrate of change#16332 from maint-5.6 branch
p4raw-link: @16332 on //depot/maint-5.6/perl: 9bf7742e23b67e3d7c671615795c570c51951513
p4raw-id: //depot/perl@16348
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -990,11 +990,16 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg) #if defined(VMS) || defined(EPOC) Perl_die(aTHX_ "Can't make list assignment to %%ENV on this system"); #else -# if defined(PERL_IMPLICIT_SYS) || defined(WIN32) +# if defined(PERL_IMPLICIT_SYS) || defined(WIN32) PerlEnv_clearenv(); -# else -# ifdef USE_ENVIRON_ARRAY -# ifndef PERL_USE_SAFE_PUTENV +# else +# ifdef USE_ENVIRON_ARRAY +# if defined(USE_ITHREADS) + /* only the parent thread can clobber the process environment */ + if (PL_curinterp == aTHX) +# endif + { +# ifndef PERL_USE_SAFE_PUTENV I32 i; if (environ == PL_origenviron) @@ -1002,11 +1007,11 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg) else for (i = 0; environ[i]; i++) safesysfree(environ[i]); -# endif /* PERL_USE_SAFE_PUTENV */ +# endif /* PERL_USE_SAFE_PUTENV */ environ[0] = Nullch; - -# endif /* USE_ENVIRON_ARRAY */ + } +# endif /* USE_ENVIRON_ARRAY */ # endif /* PERL_IMPLICIT_SYS || WIN32 */ #endif /* VMS || EPC */ return 0; @@ -2239,7 +2244,12 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) break; } /* can grab env area too? */ - if (PL_origenviron && (PL_origenviron[0] == s + 1)) { + if (PL_origenviron +#ifdef USE_ITHREADS + && PL_curinterp == aTHX +#endif + && (PL_origenviron[0] == s + 1)) + { my_setenv("NoNe SuCh", Nullch); /* force copy of environment */ for (i = 0; PL_origenviron[i]; i++) |