summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 9b6d240..8526876 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1946,13 +1946,19 @@ struct passwd *getpwuid(int uid)
static unsigned initialized;
static char user_name[100];
static struct passwd *p;
+ wchar_t buf[100];
DWORD len;
if (initialized)
return p;
- len = sizeof(user_name);
- if (!GetUserName(user_name, &len)) {
+ len = sizeof(buf);
+ if (!GetUserNameW(buf, &len)) {
+ initialized = 1;
+ return NULL;
+ }
+
+ if (xwcstoutf(user_name, buf, sizeof(user_name)) < 0) {
initialized = 1;
return NULL;
}