Skip to content

Commit

Permalink
* sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has
Browse files Browse the repository at this point in the history
	neither IPv4 nor IPv6 addresses defined, don't do anything.
  • Loading branch information
Ulrich Drepper committed Nov 27, 2008
1 parent d6c9ebb commit ca4dc0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2008-11-26 Ulrich Drepper <drepper@redhat.com>

* sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system has
neither IPv4 nor IPv6 addresses defined, don't do anything.

2008-11-26 Roland McGrath <roland@redhat.com>

* sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Renamed to ...
Expand Down
6 changes: 6 additions & 0 deletions sysdeps/posix/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit ca4dc0f

Please sign in to comment.