nghttpx: Fix dead code found by coverity scan
This commit is contained in:
parent
46acf32c41
commit
02d34c8c4c
|
@ -293,9 +293,11 @@ void DNSResolver::on_result(int status, hostent *hostent) {
|
|||
return;
|
||||
}
|
||||
|
||||
auto ap = *hostent->h_addr_list;
|
||||
assert(ap);
|
||||
|
||||
switch (hostent->h_addrtype) {
|
||||
case AF_INET:
|
||||
for (auto ap = hostent->h_addr_list; *ap; ++ap) {
|
||||
status_ = DNS_STATUS_OK;
|
||||
result_.len = sizeof(result_.su.in);
|
||||
result_.su.in = {};
|
||||
|
@ -303,12 +305,9 @@ void DNSResolver::on_result(int status, hostent *hostent) {
|
|||
#ifdef HAVE_SOCKADDR_IN_SIN_LEN
|
||||
result_.su.in.sin_len = sizeof(result_.su.in);
|
||||
#endif // HAVE_SOCKADDR_IN_SIN_LEN
|
||||
memcpy(&result_.su.in.sin_addr, *ap, sizeof(result_.su.in.sin_addr));
|
||||
break;
|
||||
}
|
||||
memcpy(&result_.su.in.sin_addr, ap, sizeof(result_.su.in.sin_addr));
|
||||
break;
|
||||
case AF_INET6:
|
||||
for (auto ap = hostent->h_addr_list; *ap; ++ap) {
|
||||
status_ = DNS_STATUS_OK;
|
||||
result_.len = sizeof(result_.su.in6);
|
||||
result_.su.in6 = {};
|
||||
|
@ -316,9 +315,7 @@ void DNSResolver::on_result(int status, hostent *hostent) {
|
|||
#ifdef HAVE_SOCKADDR_IN6_SIN6_LEN
|
||||
result_.su.in6.sin6_len = sizeof(result_.su.in6);
|
||||
#endif // HAVE_SOCKADDR_IN6_SIN6_LEN
|
||||
memcpy(&result_.su.in6.sin6_addr, *ap, sizeof(result_.su.in6.sin6_addr));
|
||||
break;
|
||||
}
|
||||
memcpy(&result_.su.in6.sin6_addr, ap, sizeof(result_.su.in6.sin6_addr));
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
|
Loading…
Reference in New Issue