diff options
author | jdp <jdp@FreeBSD.org> | 1997-04-29 03:24:57 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1997-04-29 03:24:57 +0000 |
commit | e3a67334252e979065753f5b0a592767c576f09d (patch) | |
tree | 21089b9984df97bdd3c3a147500c43a4a4ccb208 /lib | |
parent | f93fd13d028a3131431a5e826824ad71bf58da5c (diff) | |
download | FreeBSD-src-e3a67334252e979065753f5b0a592767c576f09d.zip FreeBSD-src-e3a67334252e979065753f5b0a592767c576f09d.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/fnmatch.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c index 1330ddb..0512b43 100644 --- a/lib/libc/gen/fnmatch.c +++ b/lib/libc/gen/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); |