diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-02 13:58:21 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-02 13:58:21 +0000 |
commit | b366c72ae1523f7dc25766d6191f77cb96a0f844 (patch) | |
tree | 73db6aa4dc79426cc7f1e748373388a2f14d189e /win32 | |
parent | 997f821a58a7295436e64443ab4bd1d550cd6919 (diff) |
merge revision(s) r48360,r48364: [Backport #10493]
* ext/etc/etc.c (etc_getlogin): set login name encoding properly.
[ruby-core:66163] [Bug #10493]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@49473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 3051a97f56..1653bd1aed 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -543,11 +543,15 @@ 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); + } + } + else { + 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)) && |