From: schwarze Date: Thu, 4 Aug 2016 09:33:53 +0000 (+0000) Subject: Fix an assertion failure that happened when trying to add a page X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a250d9f140eddb19e8853041b6df0238c51f2061;p=openbsd Fix an assertion failure that happened when trying to add a page with makewhatis -d to a completely empty database. Reported by Mark Patruck , thanks! --- diff --git a/usr.bin/mandoc/dba_read.c b/usr.bin/mandoc/dba_read.c index c7128de2849..b260ac1fca7 100644 --- a/usr.bin/mandoc/dba_read.c +++ b/usr.bin/mandoc/dba_read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dba_read.c,v 1.1 2016/08/01 10:32:39 schwarze Exp $ */ +/* $OpenBSD: dba_read.c,v 1.2 2016/08/04 09:33:53 schwarze Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze * @@ -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,