diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-10-21 16:47:28 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-10-21 16:47:28 +0000 |
commit | df54adb746cf0f3cb92b38abc030db5d52465f51 (patch) | |
tree | b70ca8ee6e3162737e3fbf28bd3ad7fdf7d34b1a /winsup/cygwin/passwd.cc | |
parent | 054dcc734c28ab6abf6b2461473d01c6b1c66aa1 (diff) | |
download | newlib-df54adb746cf0f3cb92b38abc030db5d52465f51.zip newlib-df54adb746cf0f3cb92b38abc030db5d52465f51.tar.gz newlib-df54adb746cf0f3cb92b38abc030db5d52465f51.tar.bz2 |
* passwd.cc (pwdgrp::read_passwd): Check if we're called within
user_shared initialization and ignore myself, if so. Reformat
conditional expression.
Diffstat (limited to 'winsup/cygwin/passwd.cc')
-rw-r--r-- | winsup/cygwin/passwd.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 1773de5..b034cf4 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -19,6 +19,7 @@ details. */ #include "pinfo.h" #include "cygheap.h" #include "pwdgrp.h" +#include "shared_info.h" /* Read /etc/passwd only once for better performance. This is done on the first call that needs information from it. */ @@ -62,20 +63,22 @@ pwdgrp::read_passwd () add_line (pretty_ls); cygsid tu = cygheap->user.sid (); tu.string (strbuf); - if (myself->uid == ILLEGAL_UID) + if (!user_shared->cb || myself->uid == ILLEGAL_UID) searchentry = !internal_getpwsid (tu); - if (searchentry && - (!(pw = internal_getpwnam (cygheap->user.name ())) || - (myself->uid != ILLEGAL_UID && - myself->uid != (__uid32_t) pw->pw_uid && - !internal_getpwuid (myself->uid)))) + if (searchentry + && (!(pw = internal_getpwnam (cygheap->user.name ())) + || !user_shared->cb + || (myself->uid != ILLEGAL_UID + && myself->uid != (__uid32_t) pw->pw_uid + && !internal_getpwuid (myself->uid)))) { static char linebuf[1024]; // must be static and // should not be NO_COPY snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh", cygheap->user.name (), - myself->uid == ILLEGAL_UID ? UNKNOWN_UID : myself->uid, - myself->gid, + (!user_shared->cb || myself->uid == ILLEGAL_UID) + ? UNKNOWN_UID : myself->uid, + !user_shared->cb ? UNKNOWN_GID : myself->gid, strbuf, getenv ("HOME") ?: ""); debug_printf ("Completing /etc/passwd: %s", linebuf); add_line (linebuf); |