aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dba_read.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-08-17 20:46:56 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-08-17 20:46:56 +0000
commitcddabf4481def808a91c9b24836ff80880d10594 (patch)
treed88818c33a80dd1f73ed529d56f2d377b63cd2c5 /dba_read.c
parent58f7533c9f4a757e9db71039330750a0b958f008 (diff)
downloadmandoc-cddabf4481def808a91c9b24836ff80880d10594.tar.gz
mandoc-cddabf4481def808a91c9b24836ff80880d10594.tar.zst
mandoc-cddabf4481def808a91c9b24836ff80880d10594.zip
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.
Diffstat (limited to 'dba_read.c')
-rw-r--r--dba_read.c9
1 files changed, 4 insertions, 5 deletions
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 <schwarze@openbsd.org>
*
@@ -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')