]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - posix/tst-gnuglob.c
When glob pattern contains a trailing slash match only directories. Fixes bug 10278.
[thirdparty/glibc.git] / posix / tst-gnuglob.c
index 0c967d0a7a7493bb7a75481e238ffff1bc0bd8ea..6e42724d08a33214d5753579035ff069d4858517 100644 (file)
@@ -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, "");