summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2007-02-05 13:45:36 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-02-06 21:48:59 +0000
commita4a109c2ec62a059b5bc094af354b4a57b9beaab (patch)
tree169a191274f80a3716a4dc5023d495a41484723e /perl.c
parent9fcebbf094867dff599e7e009ef2944e2a1d1b2c (diff)
downloadperl-a4a109c2ec62a059b5bc094af354b4a57b9beaab.tar.gz
fix 2 environment handling bugs
Message-ID: <p81gs2pggh04cngqjam0ejite7ksamiprt@4ax.com> p4raw-id: //depot/perl@30147
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/perl.c b/perl.c
index d49278a1db..fa1407fa2d 100644
--- a/perl.c
+++ b/perl.c
@@ -1556,8 +1556,10 @@ setuid perl scripts securely.\n");
break;
}
}
+
+#ifndef PERL_USE_SAFE_PUTENV
/* Can we grab env area too to be used as the area for $0? */
- if (s && PL_origenviron) {
+ if (s && PL_origenviron && !PL_use_safe_putenv) {
if ((PL_origenviron[0] == s + 1)
||
(aligned &&
@@ -1589,6 +1591,8 @@ setuid perl scripts securely.\n");
}
}
}
+#endif /* !defined(PERL_USE_SAFE_PUTENV) */
+
PL_origalen = s ? s - PL_origargv[0] + 1 : 0;
}
@@ -4687,7 +4691,6 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
environ[0] = NULL;
}
if (env) {
- char** origenv = environ;
char *s;
SV *sv;
for (; *env; env++) {
@@ -4702,11 +4705,6 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
(void)hv_store(hv, *env, s - *env, sv, 0);
if (env_is_not_environ)
mg_set(sv);
- if (origenv != environ) {
- /* realloc has shifted us */
- env = (env - origenv) + environ;
- origenv = environ;
- }
}
}
#endif /* USE_ENVIRON_ARRAY */