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 /resolv/nss_dns/dns-canon.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz glibc-a334319f6530564d22e775935d9c91663623a1b4.zip |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'resolv/nss_dns/dns-canon.c')
-rw-r--r-- | resolv/nss_dns/dns-canon.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c index fca6cd8997..91708df51f 100644 --- a/resolv/nss_dns/dns-canon.c +++ b/resolv/nss_dns/dns-canon.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -40,10 +40,6 @@ typedef union querybuf } querybuf; -static const short int qtypes[] = { ns_t_a, ns_t_aaaa }; -#define nqtypes (sizeof (qtypes) / sizeof (qtypes[0])) - - enum nss_status _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen, char **result,int *errnop, int *h_errnop) @@ -57,6 +53,8 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen, unsigned char *ptr; } ansp = { .ptr = buf }; enum nss_status status = NSS_STATUS_UNAVAIL; + int qtypes[] = { ns_t_a, ns_t_aaaa }; +#define nqtypes (sizeof (qtypes) / sizeof (qtypes[0])) for (int i = 0; i < nqtypes; ++i) { @@ -103,8 +101,7 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen, ptr += s; /* Check whether type and class match. */ - uint_fast16_t type; - NS_GET16 (type, ptr); + unsigned int type = ntohs (*(uint16_t *) ptr); if (type == qtypes[i]) { /* We found the record. */ @@ -133,14 +130,15 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen, if (type != ns_t_cname) goto unavail; - if (ns_get16 (ptr) != ns_c_in) + ptr += sizeof (uint16_t); + if (*(uint16_t *) ptr != htons (ns_c_in)) goto unavail; /* Also skip over the TTL. */ ptr += sizeof (uint16_t) + sizeof (uint32_t); /* Skip over the data length and data. */ - ptr += sizeof (uint16_t) + ns_get16 (ptr); + ptr += sizeof (uint16_t) + ntohs (*(uint16_t *) ptr); } } } |