summaryrefslogtreecommitdiff
path: root/glob/glob.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-10-20 13:18:03 -0400
committerPaul Smith <psmith@gnu.org>2013-10-20 13:18:50 -0400
commit5d653b535a0e0e607c8be2016bcaadd6f326a698 (patch)
tree8f7c1045bc1f86f8e57bb400f557dd333403ebb4 /glob/glob.c
parent53b4a9e66800dde643d3ce7966c5193001e3f12e (diff)
downloadgunmake-5d653b535a0e0e607c8be2016bcaadd6f326a698.tar.gz
* glob.c (glob) [SV 18123]: Cherry-pick glibc fix
Apply commit a471e96a5352a5f0bde6d32dd36d33524811a2b1 from git://sourceware.org/git/glibc.git to fix https://sourceware.org/bugzilla/show_bug.cgi?id=10278
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, '{');