This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug network/15726] getaddrinfo() returns incorrect status
- From: "carlos at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 18 Jul 2013 17:43:22 +0000
- Subject: [Bug network/15726] getaddrinfo() returns incorrect status
- Auto-submitted: auto-generated
- References: <bug-15726-131 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=15726
--- Comment #15 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Rich Felker from comment #14)
> On Thu, Jul 18, 2013 at 07:03:09AM +0000, carlos at redhat dot com wrote:
> > What about EAI_NODATA which glibc still uses? It would seem that EAI_NODATA is
> > more likely be returned in the current implementation than EAI_NONAME (which is
> > mostly returned for the parameter errors discussed).
>
> EAI_NODATA is not even in the specification for this function; I don't
> know why it exists at all, as it could badly confuse conforming
> applications which don't expect a positive "successful query with no
> result" return code other than the specified EAI_NONAME.
EAI_NODATA is defined under GNU source and was part of the getaddrinfo
specification at one point and was then removed.
It is not documented anywhere in glibc (classic glibc).
The linux man pages project says:
~~~
EAI_NODATA
The specified network host exists, but does not have
any network addresses defined.
~~~
> On the other hand, I see the motivation, at least according to the
> documentation. The Linux man page suggests glibc is using EAI_NONAME
> when there is no such host/domain name, and EAI_NODATA when the
> hostname exists but does not have any A or AAAA records (nor a CNAME
> pointing to one that does).
>
> Is it behaving differently from how it's documented?
It behaves as documented.
For example the following pseudo code:
hints.ai_family = AF_INET6;
print_errorcode (getaddrinfo ("www.redhat.com", NULL, &hints, &result));
Would print:
EAI_NODATA
Since the host exists but it has no AAAA record.
If you remove /etc/resolv.conf it prints:
EAI_NONAME
As expected since given your system configuration there is no such host/domain
name.
Does that make sense?
--
You are receiving this mail because:
You are on the CC list for the bug.