diff options
-rw-r--r-- | include/mingw.h | 2 | ||||
-rw-r--r-- | win32/mingw.c | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h index 9e6ddd1d8..59218a9df 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -75,7 +75,7 @@ struct passwd { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); | 77 | IMPL(getpwnam,struct passwd *,NULL,const char *name UNUSED_PARAM); |
78 | IMPL(getpwuid,struct passwd *,NULL,int uid UNUSED_PARAM); | 78 | struct passwd *getpwuid(int uid); |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * signal.h | 81 | * signal.h |
diff --git a/win32/mingw.c b/win32/mingw.c index 9ce7bc3ff..2b9776175 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -76,3 +76,17 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) | |||
76 | memcpy(result, localtime(timep), sizeof(struct tm)); | 76 | memcpy(result, localtime(timep), sizeof(struct tm)); |
77 | return result; | 77 | return result; |
78 | } | 78 | } |
79 | |||
80 | struct passwd *getpwuid(int uid) | ||
81 | { | ||
82 | static char user_name[100]; | ||
83 | static struct passwd p; | ||
84 | |||
85 | DWORD len = sizeof(user_name); | ||
86 | if (!GetUserName(user_name, &len)) | ||
87 | return NULL; | ||
88 | p.pw_name = user_name; | ||
89 | p.pw_gecos = "unknown"; | ||
90 | p.pw_dir = NULL; | ||
91 | return &p; | ||
92 | } | ||