summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-30 16:10:48 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-30 16:10:48 +0000
commit3fb8bece12acd754e80bcd703dbc1e0930e6efef (patch)
treea31a5b86d7db472050280cedb834730e79477bd4
parent053747b5129810d60ae7b0e45af8655384cd02ca (diff)
downloadphp-git-3fb8bece12acd754e80bcd703dbc1e0930e6efef.tar.gz
MFB: Thread-safety issues
-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;