From cddabf4481def808a91c9b24836ff80880d10594 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 17 Aug 2016 20:46:56 +0000 Subject: When the content of a manual page does not specify a section, the empty string got added to the list of sections, breaking the database format slightly and causing the page to not be considered part of any section, not even if a section could be deduced from the directory or from the file name. Bug found due to the bogus pcredemo(3) "manual" in the pcre-8.38p0 package. --- dba_read.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'dba_read.c') diff --git a/dba_read.c b/dba_read.c index b24bd2e7..e9760570 100644 --- a/dba_read.c +++ b/dba_read.c @@ -1,4 +1,4 @@ -/* $Id: dba_read.c,v 1.3 2016/08/17 18:59:37 schwarze Exp $ */ +/* $Id: dba_read.c,v 1.4 2016/08/17 20:46:56 schwarze Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze * @@ -48,12 +48,11 @@ dba_read(const char *fname) dba = dba_new(npages < 128 ? 128 : npages); for (ip = 0; ip < npages; ip++) { pdata = dbm_page_get(ip); - page = dba_page_new(dba->pages, NULL, pdata->sect, - pdata->arch, pdata->desc, pdata->file + 1, *pdata->file); + page = dba_page_new(dba->pages, pdata->arch, + pdata->desc, pdata->file + 1, *pdata->file); for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1) dba_page_add(page, DBP_NAME, cp); - cp = pdata->sect; - while (*(cp = strchr(cp, '\0') + 1) != '\0') + for (cp = pdata->sect; *cp != '\0'; cp = strchr(cp, '\0') + 1) dba_page_add(page, DBP_SECT, cp); if ((cp = pdata->arch) != NULL) while (*(cp = strchr(cp, '\0') + 1) != '\0') -- cgit v1.2.3