Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-09-26 19:45:10 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-09-26 19:45:10 +0400
commitebdc75d9b5556c17871cb0e9f5ba115e25c8d4d4 (patch)
tree104d2e9943892febd7781699c621315136796843 /winsup
parent71ef21429a1df119a07c3e022322337d327963a5 (diff)
* uinfo.cc (cygheap_user::init): Call GetUserNameW and convert to
multibyte here so as not to rely on the current ANSI page.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/uinfo.cc9
2 files changed, 12 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 82dc372d8..dd71ff6d4 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-26 Corinna Vinschen <corinna@vinschen.de>
+
+ * uinfo.cc (cygheap_user::init): Call GetUserNameW and convert to
+ multibyte here so as not to rely on the current ANSI page.
+
2010-09-26 Christopher Faylor <me+cygwin@cgf.cx>
* dcrt0.cc (__main): Force signal synchronization.
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 2695d8176..60db38e76 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -37,10 +37,15 @@ details. */
void
cygheap_user::init ()
{
- char user_name[UNLEN + 1];
+ WCHAR user_name[UNLEN + 1];
DWORD user_name_len = UNLEN + 1;
- set_name (GetUserName (user_name, &user_name_len) ? user_name : "unknown");
+ if (!GetUserNameW (user_name, &user_name_len))
+ wcpcpy (user_name, L"unknown");
+
+ char mb_user_name[user_name_len = sys_wcstombs (NULL, 0, user_name)];
+ sys_wcstombs (mb_user_name, user_name_len, user_name);
+ set_name (mb_user_name);
DWORD siz;
PSECURITY_DESCRIPTOR psd;