From: Jarkko Hietaniemi Date: Fri, 23 Feb 2001 01:16:25 +0000 (+0000) Subject: Rewrite putenv() using my_setenv(). (In general the vendors' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7e0f6a1f00659d26d3dff8670411159e65089d91;p=p5sagit%2Fp5-mst-13.2.git Rewrite putenv() using my_setenv(). (In general the vendors' putenv() is not to be relied on, they are either broken or leaky or both.) p4raw-id: //depot/perl@8899 --- diff --git a/perl.c b/perl.c index f5cc1cc..b90dea9 100644 --- a/perl.c +++ b/perl.c @@ -3384,7 +3384,21 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register *s = '='; #if defined(__BORLANDC__) && defined(USE_WIN32_RTL_ENV) /* Sins of the RTL. See note in my_setenv(). */ - (void)PerlEnv_putenv(savepv(*env)); + { /* Turn this into Perl_my_putenv()? */ + char *putenvp = savepv(*env); + + if (putenvp) { + char *p = putenvp; + + while (*p && *p != '=') p++; + if (p == '=') { + *p++ = 0; + my_setenv(putenvp, p); + } + + Safefree(putenvp); + } /* else what? */ + } #endif } #ifdef NEED_ENVIRON_DUP_FOR_MODIFY @@ -3394,7 +3408,7 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register safesysfree(*dup_env); safesysfree(dup_env_base); } -#endif /* NEED_ENVIRON_DUP_FOR_MODIFU */ +#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */ #endif /* USE_ENVIRON_ARRAY */ #ifdef DYNAMIC_ENV_FETCH HvNAME(hv) = savepv(ENV_HV_NAME);