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 @@ -1917,16 +1917,27 @@ int mingw_getpagesize(void)
19171917
19181918struct passwd * getpwuid (int uid )
19191919{
1920+ static unsigned initialized ;
19201921 static char user_name [100 ];
1921- static struct passwd p ;
1922+ static struct passwd * p ;
1923+ DWORD len ;
1924+
1925+ if (initialized )
1926+ return p ;
19221927
1923- DWORD len = sizeof (user_name );
1924- if (!GetUserName (user_name , & len ))
1928+ len = sizeof (user_name );
1929+ if (!GetUserName (user_name , & len )) {
1930+ initialized = 1 ;
19251931 return NULL ;
1926- p .pw_name = user_name ;
1927- p .pw_gecos = "unknown" ;
1928- p .pw_dir = NULL ;
1929- return & p ;
1932+ }
1933+
1934+ p = xmalloc (sizeof (* p ));
1935+ p -> pw_name = user_name ;
1936+ p -> pw_gecos = "unknown" ;
1937+ p -> pw_dir = NULL ;
1938+
1939+ initialized = 1 ;
1940+ return p ;
19301941}
19311942
19321943static HANDLE timer_event ;
You can’t perform that action at this time.
0 commit comments