File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1831,16 +1831,27 @@ int mingw_getpagesize(void)
18311831
18321832struct passwd * getpwuid (int uid )
18331833{
1834+ static unsigned initialized ;
18341835 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 ;
18361841
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 ;
18391845 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 ;
18441855}
18451856
18461857static HANDLE timer_event ;
You can’t perform that action at this time.
0 commit comments