From: Jarkko Hietaniemi Date: Sun, 17 Sep 2006 10:29:08 +0000 (+0300) Subject: util.c: restore Perl_my_setenv() to pre-28814 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5d12488d9324671cce63c4feed858f82530110e;p=p5sagit%2Fp5-mst-13.2.git util.c: restore Perl_my_setenv() to pre-28814 Message-ID: <450CF944.7000402@iki.fi> p4raw-id: //depot/perl@28860 --- diff --git a/util.c b/util.c index bf77cdf..6be13df 100644 --- a/util.c +++ b/util.c @@ -1556,7 +1556,9 @@ Perl_new_warnings_bitfield(pTHX_ STRLEN *buffer, const char *const bits, Copy(val, s+(nlen+1), vlen, char); \ *(s+(nlen+1+vlen)) = '\0' -#if defined(USE_ENVIRON_ARRAY) && !defined(WIN32) && !defined(NETWARE) +#ifdef USE_ENVIRON_ARRAY + /* VMS' my_setenv() is in vms.c */ +#if !defined(WIN32) && !defined(NETWARE) void Perl_my_setenv(pTHX_ const char *nam, const char *val) { @@ -1568,55 +1570,49 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val) { #ifndef PERL_USE_SAFE_PUTENV if (!PL_use_safe_putenv) { - /* The excuse for this code was that many putenv()s used to - * leak, so we manipulate environ directly -- but the claim is - * somewhat doubtful, since manipulating environment CANNOT be - * made in a safe way, the env API and the whole concept are - * fundamentally broken. */ - register I32 i = setenv_getix(nam); /* where does it go? */ - int nlen, vlen; - - if (i >= 0) { - if (environ == PL_origenviron) { /* need we copy environment? */ - I32 j; - I32 max; - char **tmpenv; - - max = i; - while (environ[max]) - max++; - tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*)); - for (j=0; j