summaryrefslogtreecommitdiff
path: root/win32/readdir.c
diff options
context:
space:
mode:
authorEdin Kadribasic <edink@php.net>2002-07-29 13:12:57 +0000
committerEdin Kadribasic <edink@php.net>2002-07-29 13:12:57 +0000
commit0737394d8085120bfac95d44d6abd21a3b62473f (patch)
treee399f80aac9242f08e4f77724b44537f0f185f4d /win32/readdir.c
parent8f94a8a7449cf0273fdbd0d00975325f870d6cd2 (diff)
downloadphp-git-0737394d8085120bfac95d44d6abd21a3b62473f.tar.gz
Fixed bug #11214 (patch by Steph Fox)
Diffstat (limited to 'win32/readdir.c')
-rw-r--r--win32/readdir.c24
1 files changed, 13 insertions, 11 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;
}