aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit9e1740ac335246e35643ad3a49a6326a9846728f (patch)
tree2bbe06297e0590bdebd14edc09669bd4674bc7df /mansearch.c
parent3710e49fec4d10ef6acfb714eabf077a7aaa3ce4 (diff)
downloadmandoc-9e1740ac335246e35643ad3a49a6326a9846728f.tar.gz
mandoc-9e1740ac335246e35643ad3a49a6326a9846728f.tar.zst
mandoc-9e1740ac335246e35643ad3a49a6326a9846728f.zip
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.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mansearch.c b/mansearch.c
index 0d60c3be..784c17be 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.76 2017/08/02 13:29:04 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.77 2017/08/22 17:50:11 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;