summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 61872e997a..9f80d3228d 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -546,11 +546,12 @@ init_env(void)
if (!GetEnvironmentVariableW(L"USERNAME", env, numberof(env)) &&
!GetUserNameW(env, (len = numberof(env), &len))) {
NTLoginName = "<Unknown>";
- return;
}
- set_env_val(L"USER");
+ else {
+ set_env_val(L"USER");
+ NTLoginName = rb_w32_wstr_to_mbstr(CP_UTF8, env, -1, NULL);
+ }
}
- NTLoginName = strdup(rb_w32_getenv("USER"));
if (!GetEnvironmentVariableW(TMPDIR, env, numberof(env)) &&
!GetEnvironmentVariableW(L"TMP", env, numberof(env)) &&