aboutsummaryrefslogtreecommitdiff
path: root/nscd/pwdcache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-02-21 23:43:21 +0000
committerUlrich Drepper <drepper@redhat.com>2005-02-21 23:43:21 +0000
commit4379b403412eff757728a57d33bfdd66eebda62a (patch)
tree2e7a04f593e473d437a1b4ea81bb33b15b58f790 /nscd/pwdcache.c
parent553cc5f9ad5408fc7fb49a33417acc1446f0c548 (diff)
downloadglibc-4379b403412eff757728a57d33bfdd66eebda62a.zip
glibc-4379b403412eff757728a57d33bfdd66eebda62a.tar.gz
glibc-4379b403412eff757728a57d33bfdd66eebda62a.tar.bz2
* 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.
Diffstat (limited to 'nscd/pwdcache.c')
-rw-r--r--nscd/pwdcache.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index e8b9578..b67b0f2 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -1,5 +1,5 @@
/* Cache handling for passwd 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 <drepper@cygnus.com>, 1998.
@@ -425,11 +425,10 @@ addpwbyX (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)
{
@@ -450,7 +449,7 @@ addpwbyX (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