diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2006-11-30 16:10:48 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2006-11-30 16:10:48 +0000 |
| commit | 3fb8bece12acd754e80bcd703dbc1e0930e6efef (patch) | |
| tree | a31a5b86d7db472050280cedb834730e79477bd4 | |
| parent | 053747b5129810d60ae7b0e45af8655384cd02ca (diff) | |
| download | php-git-3fb8bece12acd754e80bcd703dbc1e0930e6efef.tar.gz | |
MFB: Thread-safety issues
| -rw-r--r-- | main/php_scandir.c | 4 |
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; |
