From: Ulrich Drepper Date: Sat, 18 Jan 2003 10:42:51 +0000 (+0000) Subject: Update. X-Git-Tag: upstream/2.20~13232 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6675b19146f30d626c5adf4c59e0626a2dc2afd0;p=platform%2Fupstream%2Flinaro-glibc.git 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. --- diff --git a/ChangeLog b/ChangeLog index 2048932..86ae489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2003-01-18 Ulrich Drepper + * 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. + * inet/rexec.c (rexec_af): Protect socket operations with TEMP_FAILURE_RETRY. Use writev instead of multiple write. * inet/rcmd.c (rcmd_af): Likewise. diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c index 2ceaa1d..fa717be 100644 --- a/nis/nss_nis/nis-alias.c +++ b/nis/nss_nis/nis-alias.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -117,24 +117,8 @@ _nss_nis_setaliasent (void) return NSS_STATUS_SUCCESS; } - -enum nss_status -_nss_nis_endaliasent (void) -{ - __libc_lock_lock (lock); - - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} +/* The 'endaliasent' function is identical. */ +strong_alias (_nss_nis_setaliasent, _nss_nis_endaliasent) static enum nss_status internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index 54f10a5..713fe31 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 , 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) diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c index 68db766..e000e6a 100644 --- a/nis/nss_nis/nis-grp.c +++ b/nis/nss_nis/nis-grp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -18,7 +18,11 @@ 02111-1307 USA. */ #include +/* The following is an ugly trick to avoid a prototype declaration for + _nss_nis_endgrent. */ +#define _nss_nis_endgrent _nss_nis_endgrent_XXX #include +#undef _nss_nis_endgrent #include #include #include @@ -58,24 +62,10 @@ _nss_nis_setgrent (int stayopen) return NSS_STATUS_SUCCESS; } - -enum nss_status -_nss_nis_endgrent (void) -{ - __libc_lock_lock (lock); - - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} +/* Make _nss_nis_endgrent an alias of _nss_nis_setgrent. We do this + even though the prototypes don't match. The argument of setgrent + is used so this makes no difference. */ +strong_alias (_nss_nis_setgrent, _nss_nis_endgrent) static enum nss_status internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen, diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index 9b03329..9e59f59 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -19,7 +19,11 @@ #include #include +/* The following is an ugly trick to avoid a prototype declaration for + _nss_nis_endgrent. */ +#define _nss_nis_endhostent _nss_nis_endhostent_XXX #include +#undef _nss_nis_endhostent #include #include #include @@ -115,24 +119,10 @@ _nss_nis_sethostent (int stayopen) return NSS_STATUS_SUCCESS; } - -enum nss_status -_nss_nis_endhostent (void) -{ - __libc_lock_lock (lock); - - new_start = 1; - if (oldkey != NULL) - { - free (oldkey); - oldkey = NULL; - oldkeylen = 0; - } - - __libc_lock_unlock (lock); - - return NSS_STATUS_SUCCESS; -} +/* Make _nss_nis_endhostent an alias of _nss_nis_sethostent. We do this + even though the prototypes don't match. The argument of sethostent + is used so this makes no difference. */ +strong_alias (_nss_nis_sethostent, _nss_nis_endhostent) /* The calling function always need to get a lock first. */ static enum nss_status diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c index 6affdb5..c25422f 100644 --- a/nis/nss_nis/nis-service.c +++ b/nis/nss_nis/nis-service.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1996. @@ -88,15 +88,8 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval, } static enum nss_status -internal_nis_setservent (intern_t *intern) +internal_nis_endservent (intern_t * intern) { - char *domainname; - struct ypall_callback ypcb; - enum nss_status status; - - if (yp_get_default_domain (&domainname)) - return NSS_STATUS_UNAVAIL; - while (intern->start != NULL) { if (intern->start->val != NULL) @@ -107,21 +100,17 @@ internal_nis_setservent (intern_t *intern) } intern->start = NULL; - ypcb.foreach = saveit; - ypcb.data = (char *) intern; - status = yperr2nss (yp_all (domainname, "services.byname", &ypcb)); - intern->next = intern->start; - - return status; + return NSS_STATUS_SUCCESS; } + enum nss_status -_nss_nis_setservent (int stayopen) +_nss_nis_endservent (void) { enum nss_status status; __libc_lock_lock (lock); - status = internal_nis_setservent (&intern); + status = internal_nis_endservent (&intern); __libc_lock_unlock (lock); @@ -129,29 +118,32 @@ _nss_nis_setservent (int stayopen) } static enum nss_status -internal_nis_endservent (intern_t * intern) +internal_nis_setservent (intern_t *intern) { - while (intern->start != NULL) - { - if (intern->start->val != NULL) - free (intern->start->val); - intern->next = intern->start; - intern->start = intern->start->next; - free (intern->next); - } - intern->start = NULL; + char *domainname; + struct ypall_callback ypcb; + enum nss_status status; - return NSS_STATUS_SUCCESS; -} + if (yp_get_default_domain (&domainname)) + return NSS_STATUS_UNAVAIL; + (void) internal_nis_endservent (intern); + + ypcb.foreach = saveit; + ypcb.data = (char *) intern; + status = yperr2nss (yp_all (domainname, "services.byname", &ypcb)); + intern->next = intern->start; + + return status; +} enum nss_status -_nss_nis_endservent (void) +_nss_nis_setservent (int stayopen) { enum nss_status status; __libc_lock_lock (lock); - status = internal_nis_endservent (&intern); + status = internal_nis_setservent (&intern); __libc_lock_unlock (lock);