summaryrefslogtreecommitdiff
path: root/src/resolv/async_resolv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolv/async_resolv.c')
-rw-r--r--src/resolv/async_resolv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c
index 1eb0acf8..ad9d5829 100644
--- a/src/resolv/async_resolv.c
+++ b/src/resolv/async_resolv.c
@@ -1453,8 +1453,9 @@ resolv_get_string_ptr_address(TALLOC_CTX *mem_ctx,
}
struct sockaddr_storage *
-resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx, struct resolv_hostent *hostent,
- int port, int index)
+resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx,
+ struct resolv_hostent *hostent,
+ int port, int addrindex)
{
struct sockaddr_storage *sockaddr;
@@ -1470,14 +1471,16 @@ resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx, struct resolv_hostent *ho
case AF_INET:
sockaddr->ss_family = AF_INET;
memcpy(&((struct sockaddr_in *) sockaddr)->sin_addr,
- hostent->addr_list[0]->ipaddr, sizeof(struct in_addr));
+ hostent->addr_list[addrindex]->ipaddr,
+ sizeof(struct in_addr));
((struct sockaddr_in *) sockaddr)->sin_port = (in_port_t) htons(port);
break;
case AF_INET6:
sockaddr->ss_family = AF_INET6;
memcpy(&((struct sockaddr_in6 *) sockaddr)->sin6_addr,
- hostent->addr_list[0]->ipaddr, sizeof(struct in6_addr));
+ hostent->addr_list[addrindex]->ipaddr,
+ sizeof(struct in6_addr));
((struct sockaddr_in6 *) sockaddr)->sin6_port = (in_port_t) htons(port);
break;
default: