* sysdeps/posix/getaddrinfo.c (gaih_inet): Properly skip over non-matching result from nscd. Index: glibc-2.19/sysdeps/posix/getaddrinfo.c =================================================================== --- glibc-2.19.orig/sysdeps/posix/getaddrinfo.c +++ glibc-2.19/sysdeps/posix/getaddrinfo.c @@ -710,6 +710,14 @@ gaih_inet (const char *name, const struc struct gaih_addrtuple *addrfree = addrmem; for (int i = 0; i < air->naddrs; ++i) { + if (!((air->family[i] == AF_INET + && req->ai_family == AF_INET6 + && (req->ai_flags & AI_V4MAPPED) != 0) + || req->ai_family == AF_UNSPEC + || air->family[i] == req->ai_family)) + /* Skip over non-matching result. */ + continue; + socklen_t size = (air->family[i] == AF_INET ? INADDRSZ : IN6ADDRSZ); if (*pat == NULL)