* grp.cc (read_group): Revert previous change.

* uinfo.cc (pwdgrp::load): Always reset curr_lines.
This commit is contained in:
Corinna Vinschen 2003-08-17 17:50:40 +00:00
parent 919497ee6b
commit 981f9625f3
3 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2003-08-17 Pierre Humblet <pierre.humblet@ieee.org>
* grp.cc (read_group): Revert previous change.
* uinfo.cc (pwdgrp::load): Always reset curr_lines.
2003-08-17 Corinna Vinschen <corinna@vinschen.de> 2003-08-17 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Map ERROR_INVALID_BLOCK_LENGTH to EIO. * errno.cc (errmap): Map ERROR_INVALID_BLOCK_LENGTH to EIO.

View File

@ -75,10 +75,7 @@ pwdgrp::read_group ()
{ {
for (int i = 0; i < gr.curr_lines; i++) for (int i = 0; i < gr.curr_lines; i++)
if ((*group_buf)[i].gr_mem != &null_ptr) if ((*group_buf)[i].gr_mem != &null_ptr)
{
free ((*group_buf)[i].gr_mem); free ((*group_buf)[i].gr_mem);
(*group_buf)[i].gr_mem = &null_ptr;
}
load ("/etc/group"); load ("/etc/group");

View File

@ -458,6 +458,7 @@ pwdgrp::load (const char *posix_fname)
if (buf) if (buf)
free (buf); free (buf);
buf = NULL; buf = NULL;
curr_lines = 0;
pc.check (posix_fname); pc.check (posix_fname);
etc_ix = etc::init (etc_ix, pc); etc_ix = etc::init (etc_ix, pc);
@ -496,7 +497,6 @@ pwdgrp::load (const char *posix_fname)
CloseHandle (fh); CloseHandle (fh);
buf[read_bytes] = '\0'; buf[read_bytes] = '\0';
char *eptr = buf; char *eptr = buf;
curr_lines = 0;
while ((eptr = add_line (eptr))) while ((eptr = add_line (eptr)))
continue; continue;
debug_printf ("%s curr_lines %d", posix_fname, curr_lines); debug_printf ("%s curr_lines %d", posix_fname, curr_lines);