]> granicus.if.org Git - php/commitdiff
apply better fix, so that the default handle would be closed when closing its reference
authorAntony Dovgal <tony2001@php.net>
Wed, 5 Mar 2008 12:09:33 +0000 (12:09 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 5 Mar 2008 12:09:33 +0000 (12:09 +0000)
ext/standard/dir.c

index 64d1049ece44779c4b76eb9aa3bdcdfc633cca1e..42140297ee3d3e82723b7d688fa894666b8965d7 100644 (file)
@@ -278,13 +278,15 @@ PHP_FUNCTION(closedir)
 {
        zval **id, **tmp, *myself;
        php_stream *dirp;
+       int rsrc_id;
 
        FETCH_DIRP();
 
-       if (dirp->rsrc_id == DIRG(default_dir)) {
+       rsrc_id = dirp->rsrc_id;
+       zend_list_delete(dirp->rsrc_id);
+
+       if (rsrc_id == DIRG(default_dir)) {
                php_set_default_dir(-1 TSRMLS_CC);
-       } else {
-               zend_list_delete(dirp->rsrc_id);
        }
 }
 /* }}} */