diff options
Diffstat (limited to 'nis/nss_nis/nis-alias.c')
-rw-r--r-- | nis/nss_nis/nis-alias.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c index 9286e36ba6..3b0887be04 100644 --- a/nis/nss_nis/nis-alias.c +++ b/nis/nss_nis/nis-alias.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2002, 2003, 2006 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 <kukuk@vt.uni-paderborn.de>, 1996. @@ -125,53 +125,52 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer, size_t buflen, int *errnop) { char *domain; + char *result; + int len; + char *outkey; + int keylen; + char *p; + int parse_res; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; alias->alias_local = 0; /* Get the next entry until we found a correct one. */ - int parse_res; do { - char *result; - int len; - char *outkey; - int keylen; - int yperr; + enum nss_status retval; if (new_start) - yperr = yp_first (domain, "mail.aliases", &outkey, &keylen, &result, - &len); + retval = yperr2nss (yp_first (domain, "mail.aliases", + &outkey, &keylen, &result, &len)); else - yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey, - &keylen, &result, &len); - - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + retval = yperr2nss ( yp_next (domain, "mail.aliases", oldkey, + oldkeylen, &outkey, &keylen, + &result, &len)); + if (retval != NSS_STATUS_SUCCESS) { - enum nss_status retval = yperr2nss (yperr); - if (retval == NSS_STATUS_TRYAGAIN) *errnop = errno; return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if ((size_t) (len + 1) > buflen) { free (result); *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; } - char *p = strncpy (buffer, result, len); + p = strncpy (buffer, result, len); buffer[len] = '\0'; while (isspace (*p)) ++p; free (result); - parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, - buflen, errnop); - if (__builtin_expect (parse_res == -1, 0)) + parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, buflen, + errnop); + if (parse_res == -1) { free (outkey); *errnop = ERANGE; @@ -207,55 +206,56 @@ enum nss_status _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias, char *buffer, size_t buflen, int *errnop) { + enum nss_status retval; + int parse_res; + char *domain; + char *result; + int len; + char *p; + size_t namlen = strlen (name); + char name2[namlen + 1]; + size_t i; + if (name == NULL) { *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - size_t namlen = strlen (name); - char name2[namlen + 1]; - - char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; /* Convert name to lowercase. */ - size_t i; for (i = 0; i < namlen; ++i) name2[i] = _tolower (name[i]); name2[i] = '\0'; - char *result; - int len; - int yperr = yp_match (domain, "mail.aliases", name2, namlen, &result, &len); + retval = yperr2nss (yp_match (domain, "mail.aliases", name2, namlen, + &result, &len)); - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) + if (retval != NSS_STATUS_SUCCESS) { - enum nss_status retval = yperr2nss (yperr); - if (retval == NSS_STATUS_TRYAGAIN) *errnop = errno; return retval; } - if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) + if ((size_t) (len + 1) > buflen) { free (result); *errnop = ERANGE; return NSS_STATUS_TRYAGAIN; } - char *p = strncpy (buffer, result, len); + p = strncpy (buffer, result, len); buffer[len] = '\0'; while (isspace (*p)) ++p; free (result); alias->alias_local = 0; - int parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen, - errnop); - if (__builtin_expect (parse_res < 1, 0)) + parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen, errnop); + if (parse_res < 1) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; |