From cc9b94ac943caaa0292ca047a63f64a382d85d80 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Thu, 8 Jun 2017 19:30:39 +0200 Subject: [PATCH] =?UTF-8?q?BUG/MINOR:=20warning:=20=C3=A2=C2=80=C2=98need?= =?UTF-8?q?=5Fresend=C3=A2=C2=80=C2=99=20may=20be=20used=20uninitialized?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commit 201c07f68 ("MAJOR/REORG: dns: DNS resolution task and requester queues") introduces a warning during compilation: src/dns.c: In function ‘dns_resolve_recv’: src/dns.c:487:6: warning: ‘need_resend’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (need_resend) { ^ This patch initialize the variable and remove the comment about it. --- src/dns.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/dns.c b/src/dns.c index cb7de6ab6..78ee62bcc 100644 --- a/src/dns.c +++ b/src/dns.c @@ -322,7 +322,7 @@ void dns_resolve_recv(struct dgram_conn *dgram) struct dns_query_item *query; unsigned char buf[DNS_MAX_UDP_MESSAGE + 1]; unsigned char *bufend; - int fd, buflen, dns_resp, need_resend; + int fd, buflen, dns_resp, need_resend = 0; unsigned short query_id; struct eb32_node *eb; struct lru64 *lru = NULL; @@ -387,12 +387,6 @@ void dns_resolve_recv(struct dgram_conn *dgram) dns_resp = dns_validate_dns_response(buf, bufend, resolution); - /* treat errors first - * need_resend flag could be set to 0 by default before the 'switch' and then - * set to 1 only where needed, but I think it's better this way to make people - * aware they have to think twice how to set this flag when updating this portion - * of the code - */ switch (dns_resp) { case DNS_RESP_VALID: need_resend = 0;