"Gisle Vanem" <(E-Mail Removed)> writes:
> How come we must use gai_strerror() to get error-text from
> getaddrinfo(), but strerror() from getnameinfo().
>
> What where the designers thinking? Is there some logic to this?
Error reporting for getaddrinfo() and getnameinfo() is the same:
* If the return value is 0 then the function was successful.
* If the return value is EAI_SYSTEM then the error code is in
errno and you can use strerror() to get the error text.
* Otherwise use gai_strerror() on the return value to get the
error text.
The RETURN VALUE section of the getnameinfo() manual page on Linux
is a bit misleading, although the ERRORS section does mention that
EAI_SYSTEM means that the error code is in errno.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/