From: Gurusamy Sarathy Date: Thu, 17 Aug 2000 00:28:19 +0000 (+0000) Subject: trailing new %ENV entries weren't being pushed into the real X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec00bdd859a5ba69406f936bdf567b5b883c98d8;p=p5sagit%2Fp5-mst-13.2.git trailing new %ENV entries weren't being pushed into the real environment of subprocesses on Windows p4raw-id: //depot/perl@6662 --- diff --git a/t/op/magic.t b/t/op/magic.t index 7739276..27be423 100755 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -195,10 +195,10 @@ else { ok 29, ($Is_MSWin32 ? (`cmd /x /c set foo 2>NUL` eq "") : (`echo \$foo` eq "\n") ); - $ENV{NoNeSuCh} = "foo"; + $ENV{__NoNeSuCh} = "foo"; $0 = "bar"; - ok 30, ($Is_MSWin32 ? (`cmd /x /c set NoNeSuCh` eq "NoNeSuCh=foo\n") - : (`echo \$NoNeSuCh` eq "foo\n") ); + ok 30, ($Is_MSWin32 ? (`cmd /x /c set __NoNeSuCh` eq "__NoNeSuCh=foo\n") + : (`echo \$__NoNeSuCh` eq "foo\n") ); } { diff --git a/win32/perlhost.h b/win32/perlhost.h index 4509a2c..3d1ddd6 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -2218,7 +2218,7 @@ CPerlHost::CreateLocalEnvironmentStrings(VDir &vDir) dwEnvIndex = 0; lpLocalEnv = GetIndex(dwEnvIndex); while(*lpEnvPtr != '\0') { - if(lpLocalEnv == NULL) { + if(!lpLocalEnv) { // all environment overrides have been added // so copy string into place strcpy(lpStr, lpEnvPtr); @@ -2250,6 +2250,16 @@ CPerlHost::CreateLocalEnvironmentStrings(VDir &vDir) } } + while(lpLocalEnv) { + // still have environment overrides to add + // so copy the strings into place + strcpy(lpStr, lpLocalEnv); + nLength = strlen(lpLocalEnv) + 1; + lpStr += nLength; + lpEnvPtr += nLength; + lpLocalEnv = GetIndex(dwEnvIndex); + } + // add final NULL *lpStr = '\0'; }