cvs: php-src /main php_scandir.c
| From: | Ilia Alshanetsky | Date: | Thu, 30 Nov 2006 16:10:48 +0000 |
| Subject: | cvs: php-src /main php_scandir.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41790@lists.php.net to get a copy of this message | ||
iliaa Thu Nov 30 16:10:48 2006 UTC
Modified files:
/php-src/main php_scandir.c
Log:
MFB: Thread-safety issues
http://cvs.php.net/viewvc.cgi/php-src/main/php_scandir.c?r1=1.13&r2=1.14&diff_format=u
Index: php-src/main/php_scandir.c
diff -u php-src/main/php_scandir.c:1.13 php-src/main/php_scandir.c:1.14
--- php-src/main/php_scandir.c:1.13 Sun Jan 1 13:09:57 2006
+++ php-src/main/php_scandir.c Thu Nov 30 16:10:48 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_scandir.c,v 1.13 2006/01/01 13:09:57 sniper Exp $ */
+/* $Id: php_scandir.c,v 1.14 2006/11/30 16:10:48 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;