about summary refs log tree commit diff
path: root/nss/getXXbyYY_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/getXXbyYY_r.c')
-rw-r--r--nss/getXXbyYY_r.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index d20fa34498..a4dc0011a2 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -152,6 +152,18 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
       status = (*fct) (ADD_VARIABLES, resbuf, buffer, buflen,
 		       __errno_location () H_ERRNO_VAR);
 
+      /* The the status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
+	 provided buffer is too small.  In this case we should give
+	 the user the possibility to enlarge the buffer and we should
+	 not simply go on with the next service (even if the TRYAGAIN
+	 action tells us so).  */
+      if (status == NSS_STATUS_TRYAGAIN
+#ifdef NEED_H_ERRNO
+	  && *h_errnop == NETDB_INTERNAL
+#endif
+	  && errno == ERANGE)
+	break;
+
       no_more = __nss_next (&nip, REENTRANT_NAME_STRING,
 			    (void **) &fct, status, 0);
     }