diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-04-25 16:54:21 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-04-25 16:54:21 +0400 |
commit | feae8d0eabee708677d062b4809cc2408df1b554 (patch) | |
tree | e0acc36e33cff134870c20ab7967ffc7daa6cc3f /winsup/cygwin/uinfo.cc | |
parent | d551169a9fa38d2499840f409e0ca90992d6881a (diff) |
* uinfo.cc (internal_getlogin): Return pointer to struct passwd.
(uinfo_init): Accommodate the above change.
* syscalls.cc (seteuid): Ditto.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r-- | winsup/cygwin/uinfo.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index eb3f6ff81..c7b97e374 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -26,11 +26,12 @@ details. */ #include "registry.h" #include "security.h" -const char * +struct passwd * internal_getlogin (cygheap_user &user) { char username[MAX_USER_NAME]; DWORD username_len = MAX_USER_NAME; + struct passwd *pw = NULL; if (!user.name ()) if (!GetUserName (username, &username_len)) @@ -153,7 +154,6 @@ internal_getlogin (cygheap_user &user) cygsid gsid (NULL); if (ret) { - struct passwd *pw; cygsid psid; if (!strcasematch (user.name (), "SYSTEM") @@ -194,7 +194,7 @@ internal_getlogin (cygheap_user &user) } } debug_printf ("Cygwins Username: %s", user.name ()); - return user.name (); + return pw ?: getpwnam(user.name ()); } void @@ -212,7 +212,7 @@ uinfo_init () /* If uid is USHRT_MAX, the process is started from a non cygwin process or the user context was changed in spawn.cc */ if (myself->uid == USHRT_MAX) - if ((p = getpwnam (internal_getlogin (cygheap->user))) != NULL) + if ((p = internal_getlogin (cygheap->user)) != NULL) { myself->uid = p->pw_uid; /* Set primary group only if ntsec is off or the process has been |