* uinfo.cc (uinfo_init): Eliminate calls to read_etc_group()

and read_etc_passwd().
This commit is contained in:
Corinna Vinschen 2000-07-02 00:00:17 +00:00
parent ebbd4e8fb3
commit 760d376e34
2 changed files with 16 additions and 27 deletions

View File

@ -1,3 +1,8 @@
Sun Jul 2 1:57:00 2000 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (uinfo_init): Eliminate calls to read_etc_group()
and read_etc_passwd().
2000-06-28 Kazuhiro Fujieda <fujieda@jaist.ac.jp> 2000-06-28 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* assert.cc (__assert): Reduce dependency on newlib. * assert.cc (__assert): Reduce dependency on newlib.

View File

@ -162,11 +162,6 @@ internal_getlogin (struct pinfo *pi)
void void
uinfo_init () uinfo_init ()
{ {
void read_etc_passwd ();
extern int passwd_in_memory_p;
void read_etc_group ();
extern int group_in_memory_p;
char *username; char *username;
struct passwd *p; struct passwd *p;
@ -181,20 +176,9 @@ uinfo_init ()
another cygwin process without changing the user context. another cygwin process without changing the user context.
So all user infos in myself as well as the environment are So all user infos in myself as well as the environment are
(perhaps) valid. */ (perhaps) valid. */
if (myself->psid) if (!myself->psid)
if ((p = getpwnam (username = internal_getlogin (myself))) != NULL)
{ {
if (!passwd_in_memory_p)
read_etc_passwd();
if (!group_in_memory_p)
read_etc_group ();
}
else if ((p = getpwnam (username = internal_getlogin (myself))) != NULL)
{
/* calling getpwnam assures us that /etc/password has been
read in, but we can't be sure about /etc/group */
if (!group_in_memory_p)
read_etc_group ();
myself->uid = p->pw_uid; myself->uid = p->pw_uid;
myself->gid = p->pw_gid; myself->gid = p->pw_gid;
} }