Change 11399 by gsar@moonru on 2001/07/17 19:11:57
fix bugs in handling of the virtualized environment under windows;
there were bugs in propagating any changes to %ENV down to the real
environment when such changes happened in the toplevel process
(thanks to Johan Holmberg <[EMAIL PROTECTED]> for the excellent
problem identification, and for a part of the fix)
Affected files ...
... //depot/maint-5.6/perl/win32/perlhost.h#9 edit
... //depot/maint-5.6/perl/win32/win32.c#19 edit
Differences ...
==== //depot/maint-5.6/perl/win32/perlhost.h#9 (text) ====
Index: perl/win32/perlhost.h
--- perl/win32/perlhost.h.~1~ Tue Jul 17 13:15:05 2001
+++ perl/win32/perlhost.h Tue Jul 17 13:15:05 2001
@@ -2286,9 +2286,10 @@
void
CPerlHost::Clearenv(void)
{
+ dTHXo;
char ch;
LPSTR lpPtr, lpStr, lpEnvPtr;
- if(m_lppEnvList != NULL) {
+ if (m_lppEnvList != NULL) {
/* set every entry to an empty string */
for(DWORD index = 0; index < m_dwEnvCount; ++index) {
char* ptr = strchr(m_lppEnvList[index], '=');
@@ -2311,6 +2312,8 @@
ch = *++lpPtr;
*lpPtr = 0;
Add(lpStr);
+ if (!w32_pseudo_id)
+ (void)win32_putenv(lpStr);
*lpPtr = ch;
}
lpStr += strlen(lpStr) + 1;
@@ -2323,22 +2326,26 @@
char*
CPerlHost::Getenv(const char *varname)
{
- char* pEnv = Find(varname);
- if(pEnv == NULL) {
- pEnv = win32_getenv(varname);
+ dTHXo;
+ if (w32_pseudo_id) {
+ char *pEnv = Find(varname);
+ if (pEnv && !*pEnv)
+ pEnv = Nullch;
+ return pEnv;
}
else {
- if(!*pEnv)
- pEnv = 0;
+ return win32_getenv(varname);
}
-
- return pEnv;
}
int
CPerlHost::Putenv(const char *envstring)
{
+ dTHXo;
Add(envstring);
+ if (!w32_pseudo_id)
+ return win32_putenv(envstring);
+
return 0;
}
==== //depot/maint-5.6/perl/win32/win32.c#19 (text) ====
Index: perl/win32/win32.c
--- perl/win32/win32.c.~1~ Tue Jul 17 13:15:05 2001
+++ perl/win32/win32.c Tue Jul 17 13:15:05 2001
@@ -518,7 +518,7 @@
*/
const char* defaultshell = (IsWinNT()
? "cmd.exe /x/c" : "command.com /c");
- const char *usershell = getenv("PERL5SHELL");
+ const char *usershell = PerlEnv_getenv("PERL5SHELL");
w32_perlshell_items = tokenize(usershell ? usershell : defaultshell,
&w32_perlshell_tokens,
&w32_perlshell_vec);
@@ -3055,7 +3055,7 @@
}
/* look in PATH */
- pathstr = win32_getenv("PATH");
+ pathstr = PerlEnv_getenv("PATH");
New(0, fullcmd, MAX_PATH+1, char);
curfullcmd = fullcmd;
End of Patch.