summaryrefslogtreecommitdiffstats
path: root/lib/libc/db
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2009-03-28 06:12:39 +0000
committerdelphij <delphij@FreeBSD.org>2009-03-28 06:12:39 +0000
commitb0050a5c17046779382119f927d279b3e1fdaf58 (patch)
treef34a1bfe26a3bc87502f2d2f330d27b07379ac8c /lib/libc/db
parentf7cf5b5c6b97a7dd0ef0fde271a9e196d96f601c (diff)
downloadFreeBSD-src-b0050a5c17046779382119f927d279b3e1fdaf58.zip
FreeBSD-src-b0050a5c17046779382119f927d279b3e1fdaf58.tar.gz
Return meaningful errno in overflow case; print error message to stderr
in one more case. Obtained from: NetBSD via OpenBSD
Diffstat (limited to 'lib/libc/db')
-rw-r--r--lib/libc/db/hash/hash_page.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c
index d564613..29e2936 100644
--- a/lib/libc/db/hash/hash_page.c
+++ b/lib/libc/db/hash/hash_page.c
@@ -687,6 +687,7 @@ overflow_page(HTAB *hashp)
if (offset > SPLITMASK) {
if (++splitnum >= NCACHED) {
(void)_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
+ errno = EFBIG;
return (0);
}
hashp->OVFL_POINT = splitnum;
@@ -700,6 +701,7 @@ overflow_page(HTAB *hashp)
free_page++;
if (free_page >= NCACHED) {
(void)_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
+ errno = EFBIG;
return (0);
}
/*
@@ -725,6 +727,7 @@ overflow_page(HTAB *hashp)
if (++splitnum >= NCACHED) {
(void)_write(STDERR_FILENO, OVMSG,
sizeof(OVMSG) - 1);
+ errno = EFBIG;
return (0);
}
hashp->OVFL_POINT = splitnum;
@@ -768,8 +771,11 @@ found:
/* Calculate the split number for this page */
for (i = 0; (i < splitnum) && (bit > hashp->SPARES[i]); i++);
offset = (i ? bit - hashp->SPARES[i - 1] : bit);
- if (offset >= SPLITMASK)
+ if (offset >= SPLITMASK) {
+ (void)_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
+ errno = EFBIG;
return (0); /* Out of overflow pages */
+ }
addr = OADDR_OF(i, offset);
#ifdef DEBUG2
(void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
OpenPOWER on IntegriCloud