]> granicus.if.org Git - php/commitdiff
Fixed GLOB_ONLYDIR to work on GNU libc based system.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 23 Jul 2003 21:41:44 +0000 (21:41 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 23 Jul 2003 21:41:44 +0000 (21:41 +0000)
ext/standard/dir.c

index a13e8d14979cd4bfc203af412aa237f547e502c0..285a4cfe0d034dee9fb337ad212aa64fefb28e32 100644 (file)
@@ -413,7 +413,14 @@ PHP_FUNCTION(glob)
 
        array_init(return_value);
        for (n = 0; n < globbuf.gl_pathc; n++) {
-#ifdef GLOB_EMULATE_ONLYDIR
+               /* we need to this everytime since GLOB_ONLYDIR does not guarantee that
+                * all directories will be filtered. GNU libc documentation states the
+                * following: 
+                * If the information about the type of the file is easily available 
+                * non-directories will be rejected but no extra work will be done to 
+                * determine the information for each file. I.e., the caller must still be 
+                * able to filter directories out. 
+                */
                if (flags & GLOB_ONLYDIR) {
                        struct stat s;
 
@@ -425,7 +432,6 @@ PHP_FUNCTION(glob)
                                continue;
                        }
                }
-#endif
                add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
        }