From 20e3c71a62a5c238318d6da050b80d3ce08f0281 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 4 Aug 2016 09:33:57 +0000 Subject: 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! --- dba_read.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dba_read.c') diff --git a/dba_read.c b/dba_read.c index 67d8d867..bf003fa9 100644 --- a/dba_read.c +++ b/dba_read.c @@ -1,4 +1,4 @@ -/* $Id: dba_read.c,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */ +/* $Id: dba_read.c,v 1.2 2016/08/04 09:33:57 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, -- cgit v1.2.3-56-ge451