1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Return EAI_SYSTEM if we're out of file descriptors

Resolves BZ #14719.
This commit is contained in:
Siddhesh Poyarekar
2012-11-19 13:01:43 +05:30
parent f6da27e536
commit cfde9b463d
5 changed files with 46 additions and 7 deletions

View File

@ -199,6 +199,11 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
status = NSS_STATUS_TRYAGAIN;
h_errno = TRY_AGAIN;
break;
/* System has run out of file descriptors. */
case EMFILE:
case ENFILE:
h_errno = NETDB_INTERNAL;
/* Fall through. */
case ECONNREFUSED:
case ETIMEDOUT:
status = NSS_STATUS_UNAVAIL;
@ -311,14 +316,26 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
&ans2p, &nans2p, &resplen2);
if (n < 0)
{
if (errno == ESRCH)
switch (errno)
{
case ESRCH:
status = NSS_STATUS_TRYAGAIN;
h_errno = TRY_AGAIN;
break;
/* System has run out of file descriptors. */
case EMFILE:
case ENFILE:
h_errno = NETDB_INTERNAL;
/* Fall through. */
case ECONNREFUSED:
case ETIMEDOUT:
status = NSS_STATUS_UNAVAIL;
break;
default:
status = NSS_STATUS_NOTFOUND;
break;
}
else
status = (errno == ECONNREFUSED
? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
*herrnop = h_errno;
if (h_errno == TRY_AGAIN)
*errnop = EAGAIN;