aboutsummaryrefslogtreecommitdiffstats
path: root/lib/glob/fnmatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/glob/fnmatch.c')
-rw-r--r--lib/glob/fnmatch.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/glob/fnmatch.c b/lib/glob/fnmatch.c
index 6a8b574..0763609 100644
--- a/lib/glob/fnmatch.c
+++ b/lib/glob/fnmatch.c
@@ -68,10 +68,14 @@ fnmatch (pattern, string, flags)
(n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
return (FNM_NOMATCH);
- for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
- if (((flags & FNM_PATHNAME) && *n == '/') ||
- (c == '?' && *n == '\0'))
- return (FNM_NOMATCH);
+ for (c = *p++; c == '?' || c == '*'; c = *p++)
+ {
+ if (((flags & FNM_PATHNAME) && *n == '/') ||
+ (c == '?' && *n == '\0'))
+ return (FNM_NOMATCH);
+ if (c == '?')
+ n++;
+ }
if (c == '\0')
return (0);