diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2008-10-01 19:56:58 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2008-10-01 19:56:58 +0000 |
commit | 7d56f8514d0e29f8a157fe3a12b8624fcb4c240e (patch) | |
tree | 536accdf7ff81b17fb82b22c59b8f581a9b9fb32 /lib | |
parent | 47f63e702a6c8e5e733cb63319ccccbf0f553cc7 (diff) |
Fix for sequential retrieval failure when using large key/data pairs.
Closes PR 2764. Has been running on the list server for years.
OK deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/db/hash/hash_buf.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash_buf.c b/lib/libc/db/hash/hash_buf.c index 2d31534305e..0b864af82e3 100644 --- a/lib/libc/db/hash/hash_buf.c +++ b/lib/libc/db/hash/hash_buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash_buf.c,v 1.16 2005/08/05 13:03:00 espie Exp $ */ +/* $OpenBSD: hash_buf.c,v 1.17 2008/10/01 19:56:57 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -169,6 +169,21 @@ newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp) bp = LRU; } + /* If prev_bp is part of bp overflow, create a new buffer. */ + if (hashp->nbufs == 0 && (prev_bp && bp->ovfl)) { + BUFHEAD *ovfl_head, *ovfl_next; + + ovfl_head = bp->ovfl; + ovfl_next = ovfl_head; + while (ovfl_next) { + if (ovfl_next == prev_bp) { + hashp->nbufs++; + break; + } + ovfl_next = ovfl_next->ovfl; + } + } + /* * If LRU buffer is pinned, the buffer pool is too small. We need to * allocate more buffers. |