apply better fix, so that the default handle would be closed when closing its reference

This commit is contained in:
Antony Dovgal 2008-03-05 12:09:33 +00:00
parent 41bd0ca803
commit 5c46c52f09

View file

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