diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2006-12-03 15:52:17 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2006-12-03 15:52:17 +0000 |
| commit | b71ac5063eed684b5619ce763ec5bf1c02544f1f (patch) | |
| tree | ffacf1f11a0a5fc325355d2935fb7d9e2c4de1ee /main/php_scandir.c | |
| parent | 361c8b4fb4221d82b5404764fe7e39df20aa6492 (diff) | |
| download | php-git-b71ac5063eed684b5619ce763ec5bf1c02544f1f.tar.gz | |
Fixed php_readdir_r() usage in scandir emulation
Diffstat (limited to 'main/php_scandir.c')
| -rw-r--r-- | main/php_scandir.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/main/php_scandir.c b/main/php_scandir.c index 6b32e81087..7513dce1e9 100644 --- a/main/php_scandir.c +++ b/main/php_scandir.c @@ -61,11 +61,10 @@ int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) { DIR *dirp = NULL; struct dirent **vector = NULL; - struct dirent *dp = NULL; int vector_size = 0; int nfiles = 0; char entry[sizeof(struct dirent)+MAXPATHLEN]; - struct dirent *result = (struct dirent *)&entry; + struct dirent *dp = (struct dirent *)&entry; if (namelist == NULL) { return -1; @@ -75,7 +74,7 @@ int php_scandir(const char *dirname, struct dirent **namelist[], int (*selector) return -1; } - while ((dp = php_readdir_r(dirp, (struct dirent *)entry, &result)) == 0 && result) { + while (!php_readdir_r(dirp, (struct dirent *)entry, &dp) && dp) { int dsize = 0; struct dirent *newdp = NULL; |
