From 8479f23aa1d5e5477a37f46823856bdafaedfa46 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 22 Aug 2012 11:41:40 -0600 Subject: * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use gethostbyname4_r if the family is PF_UNSPEC. --- sysdeps/posix/getaddrinfo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sysdeps/posix/getaddrinfo.c') diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 81e928a..05883bd 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -832,8 +832,13 @@ gaih_inet (const char *name, const struct gaih_service *service, while (!no_more) { no_data = 0; - nss_gethostbyname4_r fct4 - = __nss_lookup_function (nip, "gethostbyname4_r"); + nss_gethostbyname4_r fct4 = NULL; + + /* gethostbyname4_r sends out parallel A and AAAA queries and + is thus only suitable for PF_UNSPEC. */ + if (req->ai_family == PF_UNSPEC) + fct4 = __nss_lookup_function (nip, "gethostbyname4_r"); + if (fct4 != NULL) { int herrno; -- cgit v1.1