diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2013-10-20 10:00:31 +0200 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2013-10-20 10:03:19 +0200 |
commit | a471e96a5352a5f0bde6d32dd36d33524811a2b1 (patch) | |
tree | 8af3c2f96199cdad14dc7e9b2a1edefbf2b6dfba /posix/glob.c | |
parent | 45c30c61c9001867c1891f5862764f084e53f348 (diff) | |
download | glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.tar.gz glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.tar.xz glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.zip |
When glob pattern contains a trailing slash match only directories. Fixes bug 10278.
Diffstat (limited to 'posix/glob.c')
-rw-r--r-- | posix/glob.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/posix/glob.c b/posix/glob.c index ece71c168f..85237c2a44 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -276,6 +276,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_DOOFFS)) /* Have to do this so `globfree' knows where to start freeing. It also makes all the code that uses gl_offs simpler. */ |