diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-12 05:54:47 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-12 05:54:47 +0000 |
commit | 4301bbbe0f115b7d7389d0b37e8c8bfcc9b2ab49 (patch) | |
tree | 92eaab91b4a5bbac2dc4b11266f4d2af431c5d62 /win32 | |
parent | 37ce3f6e0d7cbd97a82078beef12f68438cbdc86 (diff) |
* win32/win32.c (init_env): use _wputenv() instead of
SetEnvironmentVariableW() because latter doesn't set msvcrt's environ
work area, of course.
[Bug #2552]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index e046b548d1..215752210d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -435,6 +435,7 @@ init_env(void) { static const WCHAR TMPDIR[] = L"TMPDIR"; WCHAR env[_MAX_PATH]; + WCHAR *buf; DWORD len; BOOL f; @@ -458,7 +459,9 @@ init_env(void) } if (f) { regulate_path(env); - SetEnvironmentVariableW(L"HOME", env); + buf = ALLOCA_N(WCHAR, 5 + lstrlenW(env) + 1); + wsprintfW(buf, L"HOME=%s", env); + _wputenv(buf); } } @@ -468,7 +471,9 @@ init_env(void) NTLoginName = "<Unknown>"; return; } - SetEnvironmentVariableW(L"USER", env); + buf = ALLOCA_N(WCHAR, 5 + lstrlenW(env) + 1); + wsprintfW(buf, L"USER=%s", env); + _wputenv(buf); } NTLoginName = strdup(rb_w32_getenv("USER")); @@ -482,7 +487,9 @@ init_env(void) if (*(p - 1) != L'/') *p++ = L'/'; if (p - env + numberof(temp) < numberof(env)) { memcpy(p, temp, sizeof(temp)); - SetEnvironmentVariableW(TMPDIR, env); + buf = ALLOCA_N(WCHAR, lstrlenW(TMPDIR) + 1 + lstrlenW(env) + 1); + wsprintfW(buf, L"%s=%s", TMPDIR, env); + _wputenv(buf); } } } |