Date: Sat, 28 Mar 2009 06:12:39 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r190487 - head/lib/libc/db/hash Message-ID: <200903280612.n2S6CdrQ086497@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Sat Mar 28 06:12:39 2009 New Revision: 190487 URL: http://svn.freebsd.org/changeset/base/190487 Log: Return meaningful errno in overflow case; print error message to stderr in one more case. Obtained from: NetBSD via OpenBSD Modified: head/lib/libc/db/hash/hash_page.c Modified: head/lib/libc/db/hash/hash_page.c ============================================================================== --- head/lib/libc/db/hash/hash_page.c Sat Mar 28 06:05:53 2009 (r190486) +++ head/lib/libc/db/hash/hash_page.c Sat Mar 28 06:12:39 2009 (r190487) @@ -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",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903280612.n2S6CdrQ086497>