iliaa Wed Jul 23 17:41:54 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/standard dir.c
Log:
MFH: Fixed GLOB_ONLYDIR to work on GNU libc based system.
Index: php-src/ext/standard/dir.c
diff -u php-src/ext/standard/dir.c:1.109.2.9 php-src/ext/standard/dir.c:1.109.2.10
--- php-src/ext/standard/dir.c:1.109.2.9 Mon Jul 14 12:23:28 2003
+++ php-src/ext/standard/dir.c Wed Jul 23 17:41:53 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dir.c,v 1.109.2.9 2003/07/14 16:23:28 sniper Exp $ */
+/* $Id: dir.c,v 1.109.2.10 2003/07/23 21:41:53 iliaa Exp $ */
/* {{{ includes/startup/misc */
@@ -411,7 +411,14 @@
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;
@@ -423,7 +430,6 @@
continue;
}
}
-#endif
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php