summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-09-03 18:45:20 +0000
committerJim Meyering <jim@meyering.net>2001-09-03 18:45:20 +0000
commit5aa9a43b0cfc241edae4db281561cb7960fafc01 (patch)
tree5966ff5c9ed51494b5f0fedf084f9cc7a3c53114 /lib
parentf839ec4d47232626ca51c78a14d735ac3f928cf9 (diff)
downloadcoreutils-5aa9a43b0cfc241edae4db281561cb7960fafc01.tar.xz
(fnmatch_no_wildcards): Fix confusion between
usage of FNM_CASEFOLD and FNM_LEADING_DIR. The bug was spotted by Jim Meyering.
Diffstat (limited to 'lib')
-rw-r--r--lib/exclude.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/exclude.c b/lib/exclude.c
index 7df879dd1..e44145c8a 100644
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -118,20 +118,20 @@ free_exclude (struct exclude *ex)
static int
fnmatch_no_wildcards (char const *pattern, char const *f, int options)
{
- if (! (options & FNM_CASEFOLD))
- return ((options & FNM_LEADING_DIR)
+ if (! (options & FNM_LEADING_DIR))
+ return ((options & FNM_CASEFOLD)
? strcasecmp (pattern, f)
: strcmp (pattern, f));
else
{
size_t patlen = strlen (pattern);
- int r = ((options & FNM_LEADING_DIR)
+ int r = ((options & FNM_CASEFOLD)
? strncasecmp (pattern, f, patlen)
: strncmp (pattern, f, patlen));
if (! r)
{
r = f[patlen];
- if (r == '/' && (options & FNM_LEADING_DIR))
+ if (r == '/')
r = 0;
}
return r;