summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-13 05:09:17 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-13 05:09:17 +0000
commit2868e2bb2b1cf521f022c2f26ac0adccd8f45749 (patch)
tree4b9fbabd46767dcc3021b9cf1fb21e0f0694a914 /perl.c
parentdca6e23fb83957e896abba24cceb553cbf56fb78 (diff)
downloadperl-2868e2bb2b1cf521f022c2f26ac0adccd8f45749.tar.gz
The changes #8803 and #8896 that fixed JPL for use with
JDK 1.2/1.3 had somehow disappeared. p4raw-link: @8803 on //depot/perl: 103a71894980ab015937511f33d840c7f030e8a4 p4raw-id: //depot/perl@19756
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 9914935203..622d2de03f 100644
--- a/perl.c
+++ b/perl.c
@@ -3518,6 +3518,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;
PL_toptarget = NEWSV(0,0);
sv_upgrade(PL_toptarget, SVt_PVFM);
@@ -3572,6 +3574,26 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
{
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 **)
+ safesysmalloc( sizeof(char *) * (dup_env_count+1) ))) {
+ char **dup_env;
+ for (env = env_base, dup_env = dup_env_base;
+ *env;
+ env++, dup_env++) {
+ /* With environ one needs to use safesysmalloc(). */
+ *dup_env = safesysmalloc(strlen(*env) + 1);
+ (void)strcpy(*dup_env, *env);
+ }
+ *dup_env = Nullch;
+ env = dup_env_base;
+ } /* else what? */
+ }
+#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
if (env)
for (; *env; env++) {
if (!(s = strchr(*env,'=')))
@@ -3586,6 +3608,14 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
if (env != environ)
mg_set(sv);
}
+#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
+ if (dup_env_base) {
+ char **dup_env;
+ for (dup_env = dup_env_base; *dup_env; dup_env++)
+ safesysfree(*dup_env);
+ safesysfree(dup_env_base);
+ }
+#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
#endif /* USE_ENVIRON_ARRAY */
}
TAINT_NOT;