From 4379b403412eff757728a57d33bfdd66eebda62a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 21 Feb 2005 23:43:21 +0000 Subject: * nscd/nscd_gethst_r.c (nscd_gethst_r): Set *h_errnop to NETDB_INTERNAL if buffer is too small. * nscd/hstcache.c (INCR): Remove. (addhstbyX): Double buflen in each iteration rather than add INCR. * nscd/grpcache.c: Likewise. * nscd/pwdcache.c: Likewise. --- nscd/grpcache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'nscd/grpcache.c') diff --git a/nscd/grpcache.c b/nscd/grpcache.c index c565f5a682..ed84d92120 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -1,5 +1,5 @@ /* Cache handling for group lookup. - Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -429,11 +429,10 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req, { char *old_buffer = buffer; errno = 0; -#define INCR 1024 if (__builtin_expect (buflen > 32768, 0)) { - buflen += INCR; + buflen *= 2; buffer = (char *) realloc (use_malloc ? buffer : NULL, buflen); if (buffer == NULL) { @@ -454,7 +453,7 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req, else /* Allocate a new buffer on the stack. If possible combine it with the previously allocated buffer. */ - buffer = (char *) extend_alloca (buffer, buflen, buflen + INCR); + buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen); } #if 0 -- cgit v1.2.3