* grp.cc (read_etc_group): Just reuse group_buf storage for subsequent reread

of /etc/group.
* passwd.cc (read_etc_passwd): Just reuse passwd_buf storage for subsequent
reread of /etc/passwd.
This commit is contained in:
Christopher Faylor 2001-09-14 03:01:47 +00:00
parent e2e078278c
commit cd6ed3f9f5
3 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,10 @@
Thu Sep 13 23:01:00 2001 Christopher Faylor <cgf@cygnus.com>
* grp.cc (read_etc_group): Just reuse group_buf storage for subsequent
reread of /etc/group.
* passwd.cc (read_etc_passwd): Just reuse passwd_buf storage for
subsequent reread of /etc/passwd.
Thu Sep 13 20:46:05 2001 Christopher Faylor <cgf@cygnus.com> Thu Sep 13 20:46:05 2001 Christopher Faylor <cgf@cygnus.com>
* cygheap.cc (dup_now): New function. * cygheap.cc (dup_now): New function.

View File

@ -152,8 +152,7 @@ read_etc_group ()
free (group_buf[i].gr_name); free (group_buf[i].gr_name);
free (group_buf[i].gr_mem); free (group_buf[i].gr_mem);
} }
free (group_buf); curr_lines = 0;
curr_lines = max_lines = 0;
} }
FILE *f = fopen (etc_group, "rt"); FILE *f = fopen (etc_group, "rt");

View File

@ -137,8 +137,7 @@ read_etc_passwd ()
{ {
for (int i = 0; i < curr_lines; ++i) for (int i = 0; i < curr_lines; ++i)
free (passwd_buf[i].pw_name); free (passwd_buf[i].pw_name);
free (passwd_buf); curr_lines = 0;
curr_lines = max_lines = 0;
} }
FILE *f = fopen ("/etc/passwd", "rt"); FILE *f = fopen ("/etc/passwd", "rt");