summaryrefslogtreecommitdiff
path: root/resolv/res_hconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'resolv/res_hconf.c')
-rw-r--r--resolv/res_hconf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c
index e6faa6855e..b814f62dd3 100644
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -538,7 +538,8 @@ _res_hconf_reorder_addrs (struct hostent *hp)
num_ifs = 0;
- sd = __opensock ();
+ /* The SIOCGIFNETMASK ioctl will only work on an AF_INET socket. */
+ sd = __socket (AF_INET, SOCK_DGRAM, 0);
if (sd < 0)
return;
@@ -546,7 +547,7 @@ _res_hconf_reorder_addrs (struct hostent *hp)
__libc_lock_lock (lock);
/* Get a list of interfaces. */
- __ifreq (&ifr, &num);
+ __ifreq (&ifr, &num, sd);
if (!ifr)
goto cleanup;
@@ -577,7 +578,7 @@ _res_hconf_reorder_addrs (struct hostent *hp)
ifaddrs = realloc (ifaddrs, num_ifs * sizeof (ifaddrs[0]));
cleanup1:
- __if_freereq (ifr);
+ __if_freereq (ifr, num);
cleanup:
/* Release lock, preserve error value, and close socket. */