From de897c7e9f22aa5a5cd3cad3bc3d91739633a33f Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sun, 6 Oct 2013 19:07:27 +0200 Subject: [PATCH] man: fix literal file suffix parsing regression Some man pages have dots in their names, apparently. Fixes the following invoke: # man ./man.conf.5 This, however, doesn't fix parsing of e.g. "./man..conf.4.5". Instead the suffix list should be searched for a real match while also preserving their matching order. In the meantime, please don't do this (ever). Noticed-by: Thomas Klausner via NetBSD --- usr.bin/man/man.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c index aaf4bbae08..6ea0df2919 100644 --- a/usr.bin/man/man.c +++ b/usr.bin/man/man.c @@ -556,7 +556,8 @@ manual(char *page, struct manstate *mp, glob_t *pg) /* clip suffix for the suffix check below */ p = strrchr(escpage, '/'); - p = strchr(p, '.'); + while ((p = strchr(p, '.')) && !isdigit(p[1])) + ++p; if (p) p[0] = '\0'; -- 2.41.0