From: Ulrich Drepper Date: Thu, 27 Nov 2008 00:25:32 +0000 (+0000) Subject: * sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has X-Git-Tag: cvs/fedora-glibc-20090102T0809~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca4dc0fe64c2087b78c52ff9b93ecca669d56164;p=thirdparty%2Fglibc.git * sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has neither IPv4 nor IPv6 addresses defined, don't do anything. --- diff --git a/ChangeLog b/ChangeLog index 3650b0554c5..3b0ac9351e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-11-26 Ulrich Drepper + + * sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has + neither IPv4 nor IPv6 addresses defined, don't do anything. + 2008-11-26 Roland McGrath * sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Renamed to ... diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 97f3af99385..b52c371c81e 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -2110,6 +2110,11 @@ getaddrinfo (const char *name, const char *service, narrow down the search. */ if (! seen_ipv4 || ! seen_ipv6) { + if (! seen_ipv4 && ! seen_ipv6) + /* Neither IPv4 nor IPv6 interfaces exist, nothing to + return. */ + goto err_noname; + local_hints = *hints; local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6; hints = &local_hints; @@ -2119,6 +2124,7 @@ getaddrinfo (const char *name, const char *service, || (hints->ai_family == PF_INET6 && ! seen_ipv6)) { /* We cannot possibly return a valid answer. */ + err_noname: free (in6ai); return EAI_NONAME; }