diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-01-18 10:42:51 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-01-18 10:42:51 +0000 |
commit | 6675b19146f30d626c5adf4c59e0626a2dc2afd0 (patch) | |
tree | bc472f018cc789c4fff52a51c62e428b4f0eba19 /nis/nss_nis/nis-ethers.c | |
parent | 039c1b75276118560dae730b033261a1ae8df7fa (diff) | |
download | glibc-6675b19146f30d626c5adf4c59e0626a2dc2afd0.tar.gz glibc-6675b19146f30d626c5adf4c59e0626a2dc2afd0.tar.xz glibc-6675b19146f30d626c5adf4c59e0626a2dc2afd0.zip |
Update.
* nis/nss_nis/nis-hosts.c: Make _nss_nis_endhostent an alias of _nss_nis_sethostent. Work around the different prototypes. * nis/nss_nis/nis-grp.c: Make _nss_nis_endgrent an alias of _nss_nis_setgrent. Work around the different prototypes. * nis/nss_nis/nis-ethers.c (internal_nis_endetherent): New function. Split out from _nss_nis_endetherent. (internal_nis_setetherent): Use internal_nis_endetherent instead of duplicating the code. * nis/nss_nis/nis-alias.c: Make _nss_nss_nis_endaliasent an alias of _nss_nis_setaliasent. * nis/nss_nis/nis-service.c (internal_nis_setservent): Reuse internal_nis_endservent code, don't duplicate it.
Diffstat (limited to 'nis/nss_nis/nis-ethers.c')
-rw-r--r-- | nis/nss_nis/nis-ethers.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index 54f10a5d0d..713fe31e93 100644 --- a/nis/nss_nis/nis-ethers.c +++ b/nis/nss_nis/nis-ethers.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. @@ -81,15 +81,9 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval, return 0; } -static enum nss_status -internal_nis_setetherent (void) +static void +internal_nis_endetherent (void) { - char *domainname; - struct ypall_callback ypcb; - enum nss_status status; - - yp_get_default_domain (&domainname); - while (start != NULL) { if (start->val != NULL) @@ -98,7 +92,31 @@ internal_nis_setetherent (void) start = start->next; free (next); } - start = NULL; +} + +enum nss_status +_nss_nis_endetherent (void) +{ + __libc_lock_lock (lock); + + internal_nis_endetherent (); + next = NULL; + + __libc_lock_unlock (lock); + + return NSS_STATUS_SUCCESS; +} + +static enum nss_status +internal_nis_setetherent (void) +{ + char *domainname; + struct ypall_callback ypcb; + enum nss_status status; + + yp_get_default_domain (&domainname); + + internal_nis_endetherent (); ypcb.foreach = saveit; ypcb.data = NULL; @@ -122,27 +140,6 @@ _nss_nis_setetherent (int stayopen) return result; } -enum nss_status -_nss_nis_endetherent (void) -{ - __libc_lock_lock (lock); - - while (start != NULL) - { - if (start->val != NULL) - free (start->val); - next = start; - start = start->next; - free (next); - } - start = NULL; - next = NULL; - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} - static enum nss_status internal_nis_getetherent_r (struct etherent *eth, char *buffer, size_t buflen, int *errnop) |