diff options
author | Christopher Faylor <me@cgf.cx> | 2003-02-01 18:41:29 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-02-01 18:41:29 +0000 |
commit | 6688a0618e8cbdfb89b3fd3c670dcd913cd22a08 (patch) | |
tree | bfa6a15ece248ad932ad1cc8dbca23a07cec47ec /winsup | |
parent | 05d2a9a4fb0d5fb79f9696dd41dd1010f4eb2b24 (diff) | |
download | newlib-6688a0618e8cbdfb89b3fd3c670dcd913cd22a08.zip newlib-6688a0618e8cbdfb89b3fd3c670dcd913cd22a08.tar.gz newlib-6688a0618e8cbdfb89b3fd3c670dcd913cd22a08.tar.bz2 |
* grp.cc (getgrent32): Only refresh group entries when at beginning.
(internal_getgrsid): Only refresh if uninitialized.
(internal_getgrent): Ditto.
* passwd.cc (getpwent): Only refresh passwd entries when at beginning.
(pwdgrp::read_passwd): linebuf *cannot* be NO_COPY.
(internal_getpwsid): Only refresh if uninitialized.
(getpass): No need to refresh passwd data here.
* pwdgrp.h (refresh): Eliminate default.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 11 | ||||
-rw-r--r-- | winsup/cygwin/grp.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/passwd.cc | 11 | ||||
-rw-r--r-- | winsup/cygwin/pwdgrp.h | 2 |
4 files changed, 21 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 80e8c9f..d78542e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2003-02-01 Christopher Faylor <cgf@redhat.com> + + * grp.cc (getgrent32): Only refresh group entries when at beginning. + (internal_getgrsid): Only refresh if uninitialized. + (internal_getgrent): Ditto. + * passwd.cc (getpwent): Only refresh passwd entries when at beginning. + (pwdgrp::read_passwd): linebuf *cannot* be NO_COPY. + (internal_getpwsid): Only refresh if uninitialized. + (getpass): No need to refresh passwd data here. + * pwdgrp.h (refresh): Eliminate default. + 2003-01-31 Christopher Faylor <cgf@redhat.com> * dlfcn.cc (dlerror): Only report load errors once per error. diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 35bba1f..f252e3c 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -111,7 +111,7 @@ internal_getgrsid (cygsid &sid) { char sid_string[128]; - gr.refresh (); + gr.refresh (false); if (sid.string (sid_string)) for (int i = 0; i < gr.curr_lines; i++) @@ -197,8 +197,8 @@ endgrent () extern "C" struct __group32 * getgrent32 () { - gr.refresh (); - + if (grp_pos == 0) + gr.refresh (true); if (grp_pos < gr.curr_lines) return group_buf + grp_pos++; @@ -223,7 +223,7 @@ setgrent () struct __group32 * internal_getgrent (int pos) { - gr.refresh (); + gr.refresh (false); if (pos < gr.curr_lines) return group_buf + pos; diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 5dd8712..1a6654c 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -82,7 +82,8 @@ pwdgrp::read_passwd () myself->uid != (__uid32_t) pw->pw_uid && !internal_getpwuid (myself->uid)))) { - static char NO_COPY linebuf[1024]; // must be static + static char linebuf[1024]; // must be static and + // should not be NO_COPY (void) cygheap->user.ontherange (CH_HOME, NULL); snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh", cygheap->user.name (), @@ -102,7 +103,7 @@ internal_getpwsid (cygsid &sid) char *ptr1, *ptr2, *endptr; char sid_string[128] = {0,','}; - pr.refresh (); + pr.refresh (false); if (sid.string (sid_string + 2)) { @@ -252,8 +253,8 @@ getpwnam_r (const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, s extern "C" struct passwd * getpwent (void) { - pr.refresh (); - + if (pw_pos == 0) + pr.refresh (true); if (pw_pos < pr.curr_lines) return passwd_buf + pw_pos++; @@ -290,8 +291,6 @@ getpass (const char * prompt) char *pass=_reent_winsup ()->_pass; struct termios ti, newti; - pr.refresh (); - cygheap_fdget fhstdin (0); if (fhstdin < 0) diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h index 51b489f..738ee60 100644 --- a/winsup/cygwin/pwdgrp.h +++ b/winsup/cygwin/pwdgrp.h @@ -67,7 +67,7 @@ public: int curr_lines; void load (const char *); - void refresh (bool check = true) + void refresh (bool check) { if (!check && initialized) return; |