summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorMichael Schroeder <Michael.Schroeder@informatik.uni-erlangen.de>2004-11-11 16:54:43 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-11-17 10:11:20 +0000
commit50acdf951a03f778010b5632532ec99bfa7c4f6a (patch)
treec02916c2de2c738a64bdd1ac0207abd339ab86d1 /util.c
parentbe9a9b1dd000aab30f25ebe003679f9814da62af (diff)
downloadperl-50acdf951a03f778010b5632532ec99bfa7c4f6a.tar.gz
SuSE's perl safe_putenf diff
Message-ID: <20041111145443.GA1854@immd4.informatik.uni-erlangen.de> slightly reworked to make the PL_use_safe_putenv variable fit in the current framework. This patch turns on the use of safe putenv for any application that embeds a perl interpreter. p4raw-id: //depot/perl@23507
Diffstat (limited to 'util.c')
-rw-r--r--util.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util.c b/util.c
index 52319d32fb..9a90549ae6 100644
--- a/util.c
+++ b/util.c
@@ -1372,6 +1372,7 @@ Perl_my_setenv(pTHX_ char *nam, char *val)
#endif
{
#ifndef PERL_USE_SAFE_PUTENV
+ if (!PL_use_safe_putenv) {
/* most putenv()s leak, so we manipulate environ directly */
register I32 i=setenv_getix(nam); /* where does it go? */
int nlen, vlen;
@@ -1412,8 +1413,8 @@ Perl_my_setenv(pTHX_ char *nam, char *val)
environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char));
/* all that work just for this */
my_setenv_format(environ[i], nam, nlen, val, vlen);
-
-#else /* PERL_USE_SAFE_PUTENV */
+ } else {
+# endif
# if defined(__CYGWIN__) || defined( EPOC)
setenv(nam, val, 1);
# else
@@ -1428,7 +1429,9 @@ Perl_my_setenv(pTHX_ char *nam, char *val)
my_setenv_format(new_env, nam, nlen, val, vlen);
(void)putenv(new_env);
# endif /* __CYGWIN__ */
-#endif /* PERL_USE_SAFE_PUTENV */
+#ifndef PERL_USE_SAFE_PUTENV
+ }
+#endif
}
}