summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-08-22 17:50:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-08-22 17:50:11 +0000
commit661f73aad9171f674528e78e7a02eead5dd6d693 (patch)
tree423bcfae11521dd4e9b5fe705535e5d58284cc73 /mansearch.c
parent82b23db3547fe38ffdbbddca8303b1ecc1dd4235 (diff)
downloadmandoc-661f73aad9171f674528e78e7a02eead5dd6d693.tar.gz
When finding a bogus database entry,
print a meaningful warning and skip the entry. Issue reported by espie@.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mansearch.c b/mansearch.c
index 44a4efa7..47285ba4 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -188,6 +188,16 @@ mansearch(const struct mansearch *search,
mpage = *res + cur;
mandoc_asprintf(&mpage->file, "%s/%s",
paths->paths[i], page->file + 1);
+ if (access(chdir_status ? page->file + 1 :
+ mpage->file, R_OK) == -1) {
+ warn("%s", mpage->file);
+ warnx("outdated mandoc.db contains "
+ "bogus %s entry, run makewhatis %s",
+ page->file + 1, paths->paths[i]);
+ free(mpage->file);
+ free(rp);
+ continue;
+ }
mpage->names = buildnames(page);
mpage->output = buildoutput(outkey, page);
mpage->ipath = i;