cvs: php-src(PHP_5_2) /main php_scandir.c
| From: | Ilia Alshanetsky | Date: | Thu, 30 Nov 2006 16:10:38 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /main php_scandir.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41789@lists.php.net to get a copy of this message | ||
iliaa Thu Nov 30 16:10:38 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main php_scandir.c
Log:
Thread-safety issues
http://cvs.php.net/viewvc.cgi/php-src/main/php_scandir.c?r1=1.12.2.1&r2=1.12.2.1.2.1&diff_format=u
Index: php-src/main/php_scandir.c
diff -u php-src/main/php_scandir.c:1.12.2.1 php-src/main/php_scandir.c:1.12.2.1.2.1
--- php-src/main/php_scandir.c:1.12.2.1 Sun Jan 1 12:50:17 2006
+++ php-src/main/php_scandir.c Thu Nov 30 16:10:38 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_scandir.c,v 1.12.2.1 2006/01/01 12:50:17 sniper Exp $ */
+/* $Id: php_scandir.c,v 1.12.2.1.2.1 2006/11/30 16:10:38 iliaa Exp $ */
#include "php_scandir.h"
@@ -62,6 +62,8 @@
struct dirent *dp = NULL;
int vector_size = 0;
int nfiles = 0;
+ char entry[sizeof(struct dirent)+MAXPATHLEN];
+ struct dirent *result = (struct dirent *)&entry;
if (namelist == NULL) {
return -1;
@@ -71,7 +73,7 @@
return -1;
}
- while ((dp = readdir(dirp)) != NULL) {
+ while ((dp = php_readdir_r(dirp, (struct dirent *)entry, &result)) == 0 && result) {
int dsize = 0;
struct dirent *newdp = NULL;