diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-02-14 03:14:14 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-02-14 03:14:14 +0000 |
commit | 103a71894980ab015937511f33d840c7f030e8a4 (patch) | |
tree | facc950261409b42ab5402feb9da5f6d52af61df /perl.c | |
parent | 741f3e25d63cec2ca498f516e3ad73196398ec38 (diff) | |
download | perl-103a71894980ab015937511f33d840c7f030e8a4.tar.gz |
Duplicate environment for JPL so that JDK 1.2/1.3 don't get upset.
p4raw-id: //depot/perl@8803
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -3257,6 +3257,8 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register char *s; SV *sv; GV* tmpgv; + char **dup_env_base = 0; + int dup_env_count = 0; argc--,argv++; /* skip name of script */ if (PL_doswitches) { @@ -3325,6 +3327,23 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register env = environ; if (env != environ) environ[0] = Nullch; +#ifdef NEED_ENVIRON_DUP_FOR_MODIFY + { + char **env_base; + for (env_base = env; *env; env++) + dup_env_count++; + if ((dup_env_base = (char **) + safemalloc( sizeof(char *) * (dup_env_count+1) ))) { + char **dup_env; + for (env = env_base, dup_env = dup_env_base; + *env; + env++, dup_env++) + *dup_env = savepv(*env); + *dup_env = Nullch; + env = dup_env_base; + } /* else what? */ + } +#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */ for (; *env; env++) { if (!(s = strchr(*env,'='))) continue; @@ -3340,7 +3359,13 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register (void)PerlEnv_putenv(savepv(*env)); #endif } -#endif + if (dup_env_base) { + char **dup_env; + for (dup_env = dup_env_base; *dup_env; dup_env++) + Safefree(*dup_env); + Safefree(dup_env_base); + } +#endif /* USE_ENVIRON_ARRAY */ #ifdef DYNAMIC_ENV_FETCH HvNAME(hv) = savepv(ENV_HV_NAME); #endif |