cvs: php4(PHP_4_2_0) /win32 readdir.c readdir.h
| From: | Edin Kadribasic | Date: | Tue, 20 Aug 2002 07:07:42 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /win32 readdir.c readdir.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13480@lists.php.net to get a copy of this message | ||
edink Tue Aug 20 03:07:42 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/win32 readdir.c readdir.h
Log:
MFH (Fix for bug #11214, patch by Steph Fox)
Index: php4/win32/readdir.c
diff -u php4/win32/readdir.c:1.6.8.1 php4/win32/readdir.c:1.6.8.2
--- php4/win32/readdir.c:1.6.8.1 Tue Apr 23 10:55:10 2002
+++ php4/win32/readdir.c Tue Aug 20 03:07:41 2002
@@ -113,29 +113,31 @@
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;
}
Index: php4/win32/readdir.h
diff -u php4/win32/readdir.h:1.5 php4/win32/readdir.h:1.5.10.1
--- php4/win32/readdir.h:1.5 Sun Jul 2 19:46:51 2000
+++ php4/win32/readdir.h Tue Aug 20 03:07:41 2002
@@ -38,7 +38,7 @@
struct dirent *readdir(DIR *);
int readdir_r(DIR *, struct dirent *, struct dirent **);
int closedir(DIR *);
-void rewinddir(DIR *);
+int rewinddir(DIR *);
#endif /* READDIR_H */