summaryrefslogtreecommitdiff
path: root/main/php_scandir.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-30 16:10:38 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-30 16:10:38 +0000
commit930ac9a5d0c2eb2e3936f7f7373c17147cacfc1e (patch)
treedb100e43d999a4591b4f0ffe0a50c234ec1c1664 /main/php_scandir.c
parent891bd7888f0285bafa6328a0bfb84bca95625886 (diff)
downloadphp-git-930ac9a5d0c2eb2e3936f7f7373c17147cacfc1e.tar.gz
Thread-safety issues
Diffstat (limited to 'main/php_scandir.c')
-rw-r--r--main/php_scandir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/php_scandir.c b/main/php_scandir.c
index bad8d5eb70..27fc7d3ec9 100644
--- a/main/php_scandir.c
+++ b/main/php_scandir.c
@@ -62,6 +62,8 @@ int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector)
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 @@ int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector)
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;