diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /nis/nss_nis/nis-ethers.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.zip glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2 |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'nis/nss_nis/nis-ethers.c')
-rw-r--r-- | nis/nss_nis/nis-ethers.c | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c index a306428..def4c22 100644 --- a/nis/nss_nis/nis-ethers.c +++ b/nis/nss_nis/nis-ethers.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2003, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996. @@ -182,46 +182,45 @@ enum nss_status _nss_nis_gethostton_r (const char *name, struct etherent *eth, char *buffer, size_t buflen, int *errnop) { + struct parser_data *data = (void *) buffer; + enum nss_status retval; + char *domain, *result, *p; + int len, parse_res; + if (name == NULL) { *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; - char *result; - int len; - int yperr = yp_match (domain, "ethers.byname", name, strlen (name), &result, - &len); + retval = yperr2nss (yp_match (domain, "ethers.byname", name, + strlen (name), &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); - int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen, - errnop); - if (__builtin_expect (parse_res < 1, 0)) + parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop); + if (parse_res < 1) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -235,54 +234,54 @@ enum nss_status _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth, char *buffer, size_t buflen, int *errnop) { + struct parser_data *data = (void *) buffer; + enum nss_status retval; + char *domain, *result, *p; + int len, nlen, parse_res; + char buf[33]; + if (addr == NULL) { *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } - char *domain; - if (__builtin_expect (yp_get_default_domain (&domain), 0)) + if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; - char buf[33]; - int nlen = snprintf (buf, sizeof (buf), "%x:%x:%x:%x:%x:%x", - (int) addr->ether_addr_octet[0], - (int) addr->ether_addr_octet[1], - (int) addr->ether_addr_octet[2], - (int) addr->ether_addr_octet[3], - (int) addr->ether_addr_octet[4], - (int) addr->ether_addr_octet[5]); - - char *result; - int len; - int yperr = yp_match (domain, "ethers.byaddr", buf, nlen, &result, &len); - - if (__builtin_expect (yperr != YPERR_SUCCESS, 0)) - { - enum nss_status retval = yperr2nss (yperr); + nlen = sprintf (buf, "%x:%x:%x:%x:%x:%x", + (int) addr->ether_addr_octet[0], + (int) addr->ether_addr_octet[1], + (int) addr->ether_addr_octet[2], + (int) addr->ether_addr_octet[3], + (int) addr->ether_addr_octet[4], + (int) addr->ether_addr_octet[5]); + retval = yperr2nss (yp_match (domain, "ethers.byaddr", buf, + nlen, &result, &len)); + + if (retval != NSS_STATUS_SUCCESS) + { 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); - int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen, - errnop); - if (__builtin_expect (parse_res < 1, 0)) + parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop); + if (parse_res < 1) { if (parse_res == -1) return NSS_STATUS_TRYAGAIN; |