From: Ulrich Drepper Date: Wed, 12 Aug 1998 12:29:06 +0000 (+0000) Subject: (_nss_db_getXXX): If buffer is too small decrement `entidx' to allow X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c93547c090e69ba81d06fd78df9b9a6feae35121;p=thirdparty%2Fglibc.git (_nss_db_getXXX): If buffer is too small decrement `entidx' to allow retrieving the same entry again. --- diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c index 0d9fe5af89d..bb14a686e09 100644 --- a/nss/nss_db/db-XXX.c +++ b/nss/nss_db/db-XXX.c @@ -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);