Support gethostbyname_r_ERANGE.
Bug: 18802601
Change-Id: Iaa64921e96f91e330f1845c5399ee8aba39d9c10
diff --git a/libc/dns/net/nsdispatch.c b/libc/dns/net/nsdispatch.c
index fb6d8f6..d025592 100644
--- a/libc/dns/net/nsdispatch.c
+++ b/libc/dns/net/nsdispatch.c
@@ -71,6 +71,7 @@
#include <sys/cdefs.h>
#include <assert.h>
+#include <errno.h>
#include <nsswitch.h>
#include <stdarg.h>
#include <strings.h>
@@ -133,6 +134,10 @@
continue;
if (result & srclist[i].flags)
break;
+ /* Stop trying next resolver when there is a memory space fatal error. */
+ if ((result & NS_UNAVAIL) != 0 && errno == ENOSPC) {
+ break;
+ }
}
}
result &= NS_STATUSMASK; /* clear private flags in result */