summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/uinfo.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r--winsup/cygwin/uinfo.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index ff96fcc7f..0c9c3eca9 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -187,7 +187,7 @@ uinfo_init ()
extern "C" int
getlogin_r (char *name, size_t namesize)
{
- char *login = getlogin ();
+ const char *login = cygheap->user.name ();
size_t len = strlen (login) + 1;
if (len > namesize)
return ERANGE;
@@ -201,7 +201,14 @@ getlogin_r (char *name, size_t namesize)
extern "C" char *
getlogin (void)
{
- return strcpy (__getlogin_username, cygheap->user.name ());
+ static char username[UNLEN];
+ int ret = getlogin_r (username, UNLEN);
+ if (ret)
+ {
+ set_errno (ret);
+ return NULL;
+ }
+ return username;
}
extern "C" __uid32_t