From 298c8e3d6b1c3c1b69ab15a71b9ac5da9fa8a805 Mon Sep 17 00:00:00 2001 From: John Polstra Date: Tue, 29 Apr 1997 03:24:57 +0000 Subject: Fix a bug that caused some false mismatches when both FNM_PATHNAME and FNM_LEADING_DIR were specified and the pattern ended with "*". Example: pattern="src/usr.sbin/w*", string="src/usr.sbin/watch/watch.8,v". This should match, but did not. --- sys/libkern/fnmatch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/libkern') diff --git a/sys/libkern/fnmatch.c b/sys/libkern/fnmatch.c index 1330ddbf4fef..0512b436f282 100644 --- a/sys/libkern/fnmatch.c +++ b/sys/libkern/fnmatch.c @@ -93,7 +93,8 @@ fnmatch(pattern, string, flags) /* Optimize for pattern with * at end or before /. */ if (c == EOS) if (flags & FNM_PATHNAME) - return (strchr(string, '/') == NULL ? + return ((flags & FNM_LEADING_DIR) || + strchr(string, '/') == NULL ? 0 : FNM_NOMATCH); else return (0); -- cgit v1.2.3