]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(_nss_db_getXXX): If buffer is too small decrement `entidx' to allow
authorUlrich Drepper <drepper@redhat.com>
Wed, 12 Aug 1998 12:29:06 +0000 (12:29 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 12 Aug 1998 12:29:06 +0000 (12:29 +0000)
retrieving the same entry again.

nss/nss_db/db-XXX.c

index 0d9fe5af89d9e50d90f1ad25ea337e74b249f546..bb14a686e0974f36e6df6545fd63661127d6f653 100644 (file)
@@ -272,6 +272,14 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result,
     {
       key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
       status = lookup (&key, result, buffer, buflen H_ERRNO_ARG);
+      if (status == NSS_STATUS_TRYAGAIN
+#ifdef NEED_H_ERRNO
+         && *herrnop == NETDB_INTERNAL
+#endif
+         && errno == ERANGE)
+       /* Give the user a chance to get the same entry with a larger
+          buffer.  */
+       --entidx;
     }
   while (status == NSS_STATUS_RETURN);
   __libc_lock_unlock (lock);