summaryrefslogtreecommitdiff
path: root/glob/glob.c
diff options
context:
space:
mode:
Diffstat (limited to 'glob/glob.c')
-rw-r--r--glob/glob.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/glob/glob.c b/glob/glob.c
index 1a19205..f3911bc 100644
--- a/glob/glob.c
+++ b/glob/glob.c
@@ -377,6 +377,11 @@ glob (pattern, flags, errfunc, pglob)
return -1;
}
+ /* POSIX requires all slashes to be matched. This means that with
+ a trailing slash we must match only directories. */
+ if (pattern[0] && pattern[strlen (pattern) - 1] == '/')
+ flags |= GLOB_ONLYDIR;
+
if (flags & GLOB_BRACE)
{
const char *begin = strchr (pattern, '{');