mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed php_readdir_r() usage in scandir emulation
This commit is contained in:
parent
361c8b4fb4
commit
b71ac5063e
1 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue