summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-08-04 09:33:57 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-08-04 09:33:57 +0000
commitf0bdbf04c573205ec54e999b359710b52c412009 (patch)
tree85c50b7e4b2869160d0d9ab4432c863f315d5289
parent42e4191ce53a7d77deef2b37ea6b3800cf463172 (diff)
downloadmandoc-f0bdbf04c573205ec54e999b359710b52c412009.tar.gz
Fix an assertion failure that happened when trying to add a page
with makewhatis -d to a completely empty database. Reported by Mark Patruck <mark at wrapped dot cx>, thanks!
-rw-r--r--dba_read.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dba_read.c b/dba_read.c
index f36c553c..52b655c5 100644
--- a/dba_read.c
+++ b/dba_read.c
@@ -45,7 +45,7 @@ dba_read(const char *fname)
if (dbm_open(fname) == -1)
return NULL;
npages = dbm_page_count();
- dba = dba_new(npages);
+ dba = dba_new(npages < 128 ? 128 : npages);
for (ip = 0; ip < npages; ip++) {
pdata = dbm_page_get(ip);
page = dba_page_new(dba->pages, pdata->name, pdata->sect,