From 9e1740ac335246e35643ad3a49a6326a9846728f Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 22 Aug 2017 17:50:11 +0000 Subject: When finding a bogus database entry, print a meaningful warning and skip the entry. Issue reported by espie@. --- mansearch.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 * Copyright (c) 2013-2017 Ingo Schwarze @@ -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; -- cgit v1.2.3-56-ge451