summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-08-17 18:58:32 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-08-17 18:58:32 +0000
commitcc73b7d8bcec0d5c12cf08308c54e4b94e451592 (patch)
tree8bea814bbfbf9564769ba7a0a70aa3be50c7e132 /usr.bin/mandoc
parentbede6a74a6cb7a89d5fbe29670bbabb40c5321ba (diff)
When reading back a mandoc.db(5) file in order to apply incremental
changes, do not prepend a stray NAME_FILE (0x10) byte to the first names of pages. Bug found while investigating another issue reported by sthen@.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/dba.c5
-rw-r--r--usr.bin/mandoc/dba_read.c7
2 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/mandoc/dba.c b/usr.bin/mandoc/dba.c
index 3b0cf14c9a9..f48aab94b5c 100644
--- a/usr.bin/mandoc/dba.c
+++ b/usr.bin/mandoc/dba.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dba.c,v 1.3 2016/08/17 18:05:40 schwarze Exp $ */
+/* $OpenBSD: dba.c,v 1.4 2016/08/17 18:58:31 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -135,7 +135,8 @@ dba_page_new(struct dba_array *pages, const char *name, const char *sect,
page = dba_array_new(DBP_MAX, 0);
entry = dba_array_new(1, DBA_STR | DBA_GROW);
- dba_array_add(entry, prepend(name, NAME_FILE & NAME_MASK));
+ if (name != NULL)
+ dba_array_add(entry, prepend(name, NAME_FILE & NAME_MASK));
dba_array_add(page, entry);
entry = dba_array_new(1, DBA_STR | DBA_GROW);
dba_array_add(entry, (void *)sect);
diff --git a/usr.bin/mandoc/dba_read.c b/usr.bin/mandoc/dba_read.c
index b260ac1fca7..cd4db383112 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.2 2016/08/04 09:33:53 schwarze Exp $ */
+/* $OpenBSD: dba_read.c,v 1.3 2016/08/17 18:58:31 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -48,10 +48,9 @@ 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, pdata->name, pdata->sect,
+ page = dba_page_new(dba->pages, NULL, pdata->sect,
pdata->arch, pdata->desc, pdata->file + 1, *pdata->file);
- cp = pdata->name;
- while (*(cp = strchr(cp, '\0') + 1) != '\0')
+ 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')