BUILD: resolvers: avoid a possible warning on null-deref
Depending on the code that precedes the loop, gcc may emit this warning:
src/resolvers.c: In function 'resolv_process_responses':
src/resolvers.c:1009:11: warning: potential null pointer dereference [-Wnull-dereference]
1009 | if (query->type != DNS_RTYPE_SRV && flags & DNS_FLAG_TRUNCATED) {
| ~~~~~^~~~~~
However after carefully checking, r_res->header.qdcount it exclusively 1
when reaching this place, which forces the for() loop to enter for at
least one iteration, and <query> to be set. Thus there's no code path
leading to a null deref. It's possibly just because the assignment is
too far and the compiler cannot figure that the condition is always OK.
Let's just mark it to please the compiler.
(cherry picked from commit
10c1a8c3bd6a24f51616172a37f1e3ef58f8fa84)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit
3a8897f94773849c6dc15218f0f4ca7831a8df85)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>