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/tst-gnuglob.c | |
parent | 45c30c61c9001867c1891f5862764f084e53f348 (diff) | |
download | glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.tar glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.tar.gz glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.tar.bz2 glibc-a471e96a5352a5f0bde6d32dd36d33524811a2b1.zip |
When glob pattern contains a trailing slash match only directories. Fixes bug 10278.
Diffstat (limited to 'posix/tst-gnuglob.c')
-rw-r--r-- | posix/tst-gnuglob.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/posix/tst-gnuglob.c b/posix/tst-gnuglob.c index 0c967d0a7a..6e42724d08 100644 --- a/posix/tst-gnuglob.c +++ b/posix/tst-gnuglob.c @@ -168,7 +168,7 @@ my_opendir (const char *s) my_DIR *dir; - if (idx == -1) + if (idx == -1 || filesystem[idx].type != DT_DIR) { PRINTF ("my_opendir(\"%s\") == NULL\n", s); return NULL; @@ -358,7 +358,7 @@ test_result (const char *fmt, int flags, glob_t *gl, const char *str[]) break; if (str[inner] == NULL) - errstr = ok ? "" : " *** WRONG"; + errstr = ok ? "" : " *** WRONG"; else errstr = ok ? "" : " * wrong position"; @@ -483,6 +483,12 @@ main (void) "/file1lev1", "/file2lev1"); + test ("*/*/", 0 , 0, + "dir1lev1/dir1lev2/", + "dir1lev1/dir2lev2/", + "dir1lev1/dir3lev2/", + "dir2lev1/dir1lev2/"); + test ("", 0, GLOB_NOMATCH, NULL); test ("", GLOB_NOCHECK, 0, ""); |