mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-03 17:11:32 +00:00
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.
This commit is contained in:
parent
1a0345d543
commit
298c8e3d6b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25269
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user