dir.c change tested on 98, xp and rh7.3, this is the one-liner I tried
to send the list earlier in the week, fixes #14657

readdir.c changes tested on 98 and xp (not used by *nix), fixes #11214

Please cd someone commit these before 4.3.0 (or give me the karma to do
so :) ?
--- old_readdir.h       2000-07-02 23:46:52.000000000 +0000
+++ readdir.h   2002-07-25 21:06:10.000000000 +0000
@@ -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 */
--- old_readdir.c       2002-07-23 19:38:26.000000000 +0000
+++ readdir.c   2002-07-26 23:20:18.000000000 +0000
@@ -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;
 }
--- old_dir.c   2002-07-08 12:52:22.000000000 +0000
+++ dir.c       2002-07-25 19:14:10.000000000 +0000
@@ -158,7 +158,6 @@
                object_init_ex(return_value, dir_class_entry_ptr);
                add_property_stringl(return_value, "path", Z_STRVAL_PP(arg), 
Z_STRLEN_PP(arg), 1);
                add_property_resource(return_value, "handle", dirp->rsrc_id);
-               zend_list_addref(dirp->rsrc_id); /* might not be needed */
                php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug 
*/
        } else {
                php_stream_to_zval(dirp, return_value);

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to