=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.295 retrieving revision 1.296 diff -u -p -r1.295 -r1.296 --- mandoc/main.c 2017/07/01 12:02:31 1.295 +++ mandoc/main.c 2017/07/01 12:54:07 1.296 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.295 2017/07/01 12:02:31 schwarze Exp $ */ +/* $Id: main.c,v 1.296 2017/07/01 12:54:07 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze @@ -663,14 +663,23 @@ fs_lookup(const struct manpaths *paths, size_t ipath, if (globres == 0) file = mandoc_strdup(*globinfo.gl_pathv); globfree(&globinfo); - if (globres != 0) + if (globres == 0) + goto found; + if (res != NULL || ipath + 1 != paths->sz) return 0; + mandoc_asprintf(&file, "%s.%s", name, sec); + globres = access(file, R_OK); + free(file); + return globres != -1; + found: warnx("outdated mandoc.db lacks %s(%s) entry, run %s %s", name, sec, BINM_MAKEWHATIS, paths->paths[ipath]); - if (res == NULL) + if (res == NULL) { + free(file); return 1; + } *res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage)); page = *res + (*ressz - 1); page->file = file;