[PATCH][BZ #14719] Return EAI_SYSTEM from getaddrinfo if we run out of fds
Dmitry V. Levin
ldv@altlinux.org
Mon Mar 25 12:58:00 GMT 2013
Hi,
On Tue, Oct 23, 2012 at 05:18:35PM +0530, Siddhesh Poyarekar wrote:
>
> As described in the bug report, the current behaviour for getaddrinfo
> when it runs out of file descriptors is to return EAI_NOTFOUND, which
> is incorrect. Since a system error has occurred, it should be
> returning EAI_SYSTEM so that the real cause of the failure could be
> seen from errno. Attached patch does that. Tested on x86_64 Fedora
> 16 for AF_INET, AF_UNSPEC and AF_INET6. OK to commit?
>
> Regards,
> Siddhesh
>
> ChangeLog:
>
> [BZ #14719]
> * nss/getXXbyYY_r.c (INTERNAL (REENTRANT_NAME)): Set h_errno to
> NETDB_INTERNAL when NSS_STATUS_UNAVAIL.
> * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Set
> h_errno to NETDB_INTERNAL when errno is EMFILE or ENFILE.
> (_nss_dns_gethostbyname4_r): Likewise.
> * sysdeps/posix/getaddrinfo.c (gaih_inet): Set result to
> EAI_SYSTEM if NSS_STATUS_UNAVAIL.
As a side effect of this change, ECONNREFUSED results to EAI_SYSTEM
instead of EAI_AGAIN. Caught by gnulib's test-getaddrinfo which now fails
when no network is available:
http://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-getaddrinfo.c
Other apps may rely on getaddrinfo returning EAI_AGAIN in case of
ECONNREFUSED, so this is a regression.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130325/7da4d1fb/attachment.sig>
More information about the Libc-alpha
mailing list