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: "jdthood at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 11 Mar 2014 22:11:26 +0000
- Subject: [Bug network/15726] getaddrinfo() returns incorrect status
- Auto-submitted: auto-generated
- References: <bug-15726-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=15726
--- Comment #32 from Thomas Hood <jdthood at gmail dot com> ---
>From the point of view of the user of getaddrinfo() it is mainly going to be
important to distinguish the following three outcomes of the getaddrinfo()
call.
A. Success => Go ahead and use the returned address
B. Temporary failure => Retry
C. Permanent failure => Abort
Although there is ambiguity in the specs, variability in the implementations
and lack of consensus in this discussion, am I right in saying that it is
correct to program the application as follows?
0 => Success => Go ahead and use the returned address
EAI_AGAIN => Temporary failure => Retry
EAI_FAIL | EAI_NONAME => Permanent failure => Abort
With reference to the last line: EAI_FAIL is explicitly specified to indicate a
permanent failure. The "bad parameters" cause of EAI_NONAME is also a permanent
failure. And whether it should result in EAI_FAIL or EAI_NONAME or EAI_NODATA,
the absence of the hostname from the name service or absence of addresses for
that hostname in the name service is also a permanent condition which can be
regarded as a permanent failure to obtain an address for that name.
--
You are receiving this mail because:
You are on the CC list for the bug.