From f5a62d97e3bcb32dde26e632671ce81b5cc568f7 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Mon, 9 Mar 2015 09:23:46 +0530 Subject: [PATCH] Fix -Wshadow warnings (#38762) These happen due to ntohs()/htons() macro expansion in glibc. --- lib/dns/dnssec.c | 5 +++-- lib/dns/tsig.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index c4ecf65e61..7cfa82d22f 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -984,7 +984,7 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, dst_context_t *ctx = NULL; isc_mem_t *mctx; isc_result_t result; - isc_uint16_t addcount; + isc_uint16_t addcount, addcount_n; isc_boolean_t signeedsfree = ISC_FALSE; REQUIRE(source != NULL); @@ -1062,7 +1062,8 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, * Decrement the additional field counter. */ memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); - addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); + addcount_n = ntohs(addcount); + addcount = htons((isc_uint16_t)(addcount_n - 1)); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); /* diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 199515aeff..f40ec22368 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -1341,6 +1341,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, } if (tsig.siglen > 0) { + isc_uint16_t addcount_n; + sig_r.base = tsig.signature; sig_r.length = tsig.siglen; @@ -1377,7 +1379,8 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, * Decrement the additional field counter. */ memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); - addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); + addcount_n = ntohs(addcount); + addcount = htons((isc_uint16_t)(addcount_n - 1)); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); /* @@ -1616,8 +1619,11 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { * Decrement the additional field counter if necessary. */ if (has_tsig) { + isc_uint16_t addcount_n; + memmove(&addcount, &header[DNS_MESSAGE_HEADERLEN - 2], 2); - addcount = htons((isc_uint16_t)(ntohs(addcount) - 1)); + addcount_n = ntohs(addcount); + addcount = htons((isc_uint16_t)(addcount_n - 1)); memmove(&header[DNS_MESSAGE_HEADERLEN - 2], &addcount, 2); }