about summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
Diffstat (limited to 'nss')
-rw-r--r--nss/getXXbyYY_r.c7
-rw-r--r--nss/getnssent_r.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 58cf29300f..020848024b 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -244,6 +244,13 @@ done:
 #endif
   return (status == NSS_STATUS_SUCCESS
 	  ? 0 : (status == NSS_STATUS_TRYAGAIN ? errno : ENOENT));
+  return (status == NSS_STATUS_SUCCESS ? 0
+	  : status != NSS_STATUS_TRYAGAIN ? ENOENT
+#ifdef NEED_H_ERRNO
+	  /* These functions only set errno if h_errno is NETDB_INTERNAL.  */
+	  : *h_errnop != NETDB_INTERNAL ? EAGAIN
+#endif
+	  : errno);
 }
 
 
diff --git a/nss/getnssent_r.c b/nss/getnssent_r.c
index 39c867ce79..c1f8965363 100644
--- a/nss/getnssent_r.c
+++ b/nss/getnssent_r.c
@@ -197,6 +197,9 @@ __nss_getent_r (const char *getent_func_name,
     }
 
   *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
-  return (status == NSS_STATUS_SUCCESS
-	  ? 0 : status == NSS_STATUS_TRYAGAIN ? errno : ENOENT);
+  return (status == NSS_STATUS_SUCCESS ? 0
+	  : status != NSS_STATUS_TRYAGAIN ? ENOENT
+	  /* h_errno functions only set errno if h_errno is NETDB_INTERNAL.  */
+	  : (h_errnop == NULL || *h_errnop == NETDB_INTERNAL) ? errno
+	  : EAGAIN);
 }