summaryrefslogtreecommitdiff
path: root/nis/nss_nis/nis-proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis/nis-proto.c')
-rw-r--r--nis/nss_nis/nis-proto.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index 00e86dfa6b..b8c234ed6f 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998, 2000-2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -78,15 +78,9 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
-static enum nss_status
-internal_nis_setprotoent (void)
+static void
+internal_nis_endprotoent (void)
{
- char *domainname;
- struct ypall_callback ypcb;
- enum nss_status status;
-
- yp_get_default_domain (&domainname);
-
while (start != NULL)
{
if (start->val != NULL)
@@ -95,7 +89,18 @@ internal_nis_setprotoent (void)
start = start->next;
free (next);
}
- start = NULL;
+}
+
+static enum nss_status
+internal_nis_setprotoent (void)
+{
+ char *domainname;
+ struct ypall_callback ypcb;
+ enum nss_status status;
+
+ yp_get_default_domain (&domainname);
+
+ internal_nis_endprotoent ();
ypcb.foreach = saveit;
ypcb.data = NULL;
@@ -124,15 +129,7 @@ _nss_nis_endprotoent (void)
{
__libc_lock_lock (lock);
- while (start != NULL)
- {
- if (start->val != NULL)
- free (start->val);
- next = start;
- start = start->next;
- free (next);
- }
- start = NULL;
+ internal_nis_endprotoent ();
next = NULL;
__libc_lock_unlock (lock);