iliaa Sun Dec 3 15:52:37 2006 UTC
Modified files:
/php-src/main php_scandir.c
Log:
MFB: Fixed php_readdir_r() usage in scandir emulation
http://cvs.php.net/viewvc.cgi/php-src/main/php_scandir.c?r1=1.16&r2=1.17&diff_format=u
Index: php-src/main/php_scandir.c
diff -u php-src/main/php_scandir.c:1.16 php-src/main/php_scandir.c:1.17
--- php-src/main/php_scandir.c:1.16 Sun Dec 3 14:38:05 2006
+++ php-src/main/php_scandir.c Sun Dec 3 15:52:37 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_scandir.c,v 1.16 2006/12/03 14:38:05 tony2001 Exp $ */
+/* $Id: php_scandir.c,v 1.17 2006/12/03 15:52:37 iliaa Exp $ */
#include "php.h"
#include "php_scandir.h"
@@ -61,11 +61,10 @@
{
DIR *dirp = NULL;
struct dirent **vector = NULL;
- struct dirent *dp = NULL;
int vector_size = 0;
int nfiles = 0;
char entry[sizeof(struct dirent)+MAXPATHLEN];
- struct dirent *result = (struct dirent *)&entry;
+ struct dirent *dp = (struct dirent *)&entry;
if (namelist == NULL) {
return -1;
@@ -75,7 +74,7 @@
return -1;
}
- while ((dp = php_readdir_r(dirp, (struct dirent *)entry, &result)) == 0
&& result) {
+ while (!php_readdir_r(dirp, (struct dirent *)entry, &dp) && dp) {
int dsize = 0;
struct dirent *newdp = NULL;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php