aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-11-27 00:25:32 +0000
committerUlrich Drepper <drepper@redhat.com>2008-11-27 00:25:32 +0000
commitca4dc0fe64c2087b78c52ff9b93ecca669d56164 (patch)
tree82e3578964be0e3109a1c26da2670e76bdd408cb /sysdeps/posix
parentd6c9ebb777066a02020d28b1d29a6de09b08ccdf (diff)
downloadglibc-ca4dc0fe64c2087b78c52ff9b93ecca669d56164.tar
glibc-ca4dc0fe64c2087b78c52ff9b93ecca669d56164.tar.gz
glibc-ca4dc0fe64c2087b78c52ff9b93ecca669d56164.tar.bz2
glibc-ca4dc0fe64c2087b78c52ff9b93ecca669d56164.zip
* sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has
neither IPv4 nor IPv6 addresses defined, don't do anything.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 97f3af9938..b52c371c81 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;
}