diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-11-19 13:01:43 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2012-11-19 13:02:48 +0530 |
commit | cfde9b463d63092ff0908d4c2748ace648e2ead8 (patch) | |
tree | 9ac0df733a6b3a01305f937e5e55ea63f3387328 /resolv | |
parent | f6da27e53695ad1cc0e2a9490358decbbfdff5e5 (diff) | |
download | glibc-cfde9b463d63092ff0908d4c2748ace648e2ead8.zip glibc-cfde9b463d63092ff0908d4c2748ace648e2ead8.tar.gz glibc-cfde9b463d63092ff0908d4c2748ace648e2ead8.tar.bz2 |
Return EAI_SYSTEM if we're out of file descriptors
Resolves BZ #14719.
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/nss_dns/dns-host.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 6b62c058..f78b879 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -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; |