* 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.
This commit is contained in:
Christopher Faylor
2003-02-01 18:41:29 +00:00
parent 05d2a9a4fb
commit 6688a0618e
4 changed files with 21 additions and 11 deletions

View File

@@ -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;