diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-08-22 17:50:03 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-08-22 17:50:03 +0000 |
commit | 94cf2dea1afa19e340a8fd3d1aeee561d7f83f78 (patch) | |
tree | 3077c2dfbaad4842bb43682ae46a06e878e6818d /usr.bin/mandoc | |
parent | 5b7f851a53e282d05a0c0d0caf230755a682a896 (diff) |
When finding a bogus database entry,
print a meaningful warning and skip the entry.
Issue reported by espie@.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mansearch.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c index 7a8d9632ce7..8d599877b3d 100644 --- a/usr.bin/mandoc/mansearch.c +++ b/usr.bin/mandoc/mansearch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mansearch.c,v 1.59 2017/08/02 13:28:35 schwarze Exp $ */ +/* $OpenBSD: mansearch.c,v 1.60 2017/08/22 17:50:02 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -185,6 +185,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; |