File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -1831,16 +1831,27 @@ int mingw_getpagesize(void)
1831
1831
1832
1832
struct passwd * getpwuid (int uid )
1833
1833
{
1834
+ static unsigned initialized ;
1834
1835
static char user_name [100 ];
1835
- static struct passwd p ;
1836
+ static struct passwd * p ;
1837
+ DWORD len ;
1838
+
1839
+ if (initialized )
1840
+ return p ;
1836
1841
1837
- DWORD len = sizeof (user_name );
1838
- if (!GetUserName (user_name , & len ))
1842
+ len = sizeof (user_name );
1843
+ if (!GetUserName (user_name , & len )) {
1844
+ initialized = 1 ;
1839
1845
return NULL ;
1840
- p .pw_name = user_name ;
1841
- p .pw_gecos = "unknown" ;
1842
- p .pw_dir = NULL ;
1843
- return & p ;
1846
+ }
1847
+
1848
+ p = xmalloc (sizeof (* p ));
1849
+ p -> pw_name = user_name ;
1850
+ p -> pw_gecos = "unknown" ;
1851
+ p -> pw_dir = NULL ;
1852
+
1853
+ initialized = 1 ;
1854
+ return p ;
1844
1855
}
1845
1856
1846
1857
static HANDLE timer_event ;
You can’t perform that action at this time.
0 commit comments