#include <sys/cdefs.h>
#include <assert.h>
+#include <errno.h>
#include <nsswitch.h>
#include <stdarg.h>
#include <strings.h>
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 */
hp = _hf_gethtbyname2(name, af, info);
#endif
if (hp == NULL) {
- *info->he = HOST_NOT_FOUND;
+ if (*info->he == NETDB_INTERNAL && errno == ENOSPC) {
+ return NS_UNAVAIL;
+ }
return NS_NOTFOUND;
}
return NS_SUCCESS;
hp = netbsd_gethostent_r(hf, info->hp, info->buf, info->buflen,
info->he);
- if (hp == NULL)
+ if (hp == NULL) {
+ if (*info->he == NETDB_INTERNAL && errno == ENOSPC) {
+ goto nospc;
+ }
break;
+ }
if (strcasecmp(hp->h_name, name) != 0) {
char **cp;
endhostent_r(&hf);
if (hp == NULL) {
+ if (errno == ENOSPC) {
+ return NS_UNAVAIL;
+ }
*info->he = HOST_NOT_FOUND;
return NS_NOTFOUND;
}