summaryrefslogtreecommitdiff
path: root/nss/getXXbyYY_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/getXXbyYY_r.c')
-rw-r--r--nss/getXXbyYY_r.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 1067744d63..33e63d4318 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -179,6 +179,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
case -1:
return errno;
case 1:
+#ifdef NEED_H_ERRNO
+ any_service = true;
+#endif
goto done;
}
#endif
@@ -284,11 +287,11 @@ done:
#endif
*result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
#ifdef NEED_H_ERRNO
- if (status == NSS_STATUS_UNAVAIL)
- /* Either we failed to lookup the functions or the functions themselves
- had a system error. Set NETDB_INTERNAL here to let the caller know
- that the errno may have the real reason for failure. */
- *h_errnop = NETDB_INTERNAL;
+ if (status == NSS_STATUS_UNAVAIL && !any_service && errno != ENOENT)
+ /* This happens when we weren't able to use a service for reasons other
+ than the module not being found. In such a case, we'd want to tell the
+ caller that errno has the real reason for failure. */
+ *h_errnop = NETDB_INTERNAL;
else if (status != NSS_STATUS_SUCCESS && !any_service)
/* We were not able to use any service. */
*h_errnop = NO_RECOVERY;