summaryrefslogtreecommitdiff
path: root/sysdeps/posix/getaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/getaddrinfo.c')
-rw-r--r--sysdeps/posix/getaddrinfo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 97f3af9938..d346c621fb 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -714,6 +714,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
status = DL_CALL_FCT (fct4, (name, pat, tmpbuf,
tmpbuflen, &rc, &herrno,
NULL));
+ if (status == NSS_STATUS_SUCCESS)
+ break;
if (status != NSS_STATUS_TRYAGAIN
|| rc != ERANGE || herrno != NETDB_INTERNAL)
{
@@ -733,6 +735,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
tmpbuflen, 2 * tmpbuflen);
}
+ no_inet6_data = no_data;
+
if (status == NSS_STATUS_SUCCESS)
{
if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
@@ -2108,7 +2112,7 @@ getaddrinfo (const char *name, const char *service,
{
/* If we haven't seen both IPv4 and IPv6 interfaces we can
narrow down the search. */
- if (! seen_ipv4 || ! seen_ipv6)
+ if ((! seen_ipv4 || ! seen_ipv6) && (seen_ipv4 || seen_ipv6))
{
local_hints = *hints;
local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6;