1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

* sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has

neither IPv4 nor IPv6 addresses defined, don't do anything.
This commit is contained in:
Ulrich Drepper
2008-11-27 00:25:32 +00:00
parent d6c9ebb777
commit ca4dc0fe64
2 changed files with 11 additions and 0 deletions

View File

@ -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;
}