diff options
author | Edin Kadribasic <edink@php.net> | 2002-08-20 07:07:41 +0000 |
---|---|---|
committer | Edin Kadribasic <edink@php.net> | 2002-08-20 07:07:41 +0000 |
commit | 3ac117a19be942ac3fef035143bbb414f184a74c (patch) | |
tree | 25d2cd5b928f8f861133fb727de63a424333a5a7 | |
parent | 3c97c82ee797b6e318a4c410f94acd3535cf0c17 (diff) | |
download | php-git-3ac117a19be942ac3fef035143bbb414f184a74c.tar.gz |
MFH (Fix for bug #11214, patch by Steph Fox)
-rw-r--r-- | win32/readdir.c | 24 | ||||
-rw-r--r-- | win32/readdir.h | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/win32/readdir.c b/win32/readdir.c index 694a409c35..e33d19bde5 100644 --- a/win32/readdir.c +++ b/win32/readdir.c @@ -113,29 +113,31 @@ int closedir(DIR *dp) return 0; } -void rewinddir(DIR *dir_Info) +int rewinddir(DIR *dp) { /* Re-set to the beginning */ char *filespec; long handle; int index; - dir_Info->handle = 0; - dir_Info->offset = 0; - dir_Info->finished = 0; + _findclose(dp->handle); - filespec = malloc(strlen(dir_Info->dir) + 2 + 1); - strcpy(filespec, dir_Info->dir); + dp->offset = 0; + dp->finished = 0; + + filespec = malloc(strlen(dp->dir) + 2 + 1); + strcpy(filespec, dp->dir); index = strlen(filespec) - 1; if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) filespec[index] = '\0'; strcat(filespec, "/*"); - if ((handle = _findfirst(filespec, &(dir_Info->fileinfo))) < 0) { - if (errno == ENOENT) { - dir_Info->finished = 1; + if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { + if (errno == ENOENT) + dp->finished = 1; } - } - dir_Info->handle = handle; + dp->handle = handle; free(filespec); + +return 0; } diff --git a/win32/readdir.h b/win32/readdir.h index b0f1ad9e6f..aed9a44788 100644 --- a/win32/readdir.h +++ b/win32/readdir.h @@ -38,7 +38,7 @@ DIR *opendir(const char *); struct dirent *readdir(DIR *); int readdir_r(DIR *, struct dirent *, struct dirent **); int closedir(DIR *); -void rewinddir(DIR *); +int rewinddir(DIR *); #endif /* READDIR_H */ |