]> granicus.if.org Git - php/commitdiff
MFH: add PHP_STREAM_FLAG_FCLOSE, bz2 streams can be closed with fclose()
authorAntony Dovgal <tony2001@php.net>
Wed, 23 Jul 2008 08:56:37 +0000 (08:56 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 23 Jul 2008 08:56:37 +0000 (08:56 +0000)
ext/bz2/bz2.c

index 6939010d0724be1c5dec1f64bd0c0944bb2b0c65..9bd15e69f55dab93b3a608c8df68b7ac9d5c60a3 100644 (file)
@@ -247,7 +247,9 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
                        if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
                                bz_file = BZ2_bzdopen(fd, mode);
                        }
+                       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
                }
+
                /* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
                 * failed.
                 */
@@ -259,6 +261,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
        if (bz_file) {
                retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC TSRMLS_CC);
                if (retstream) {
+                       retstream->flags |= PHP_STREAM_FLAG_FCLOSE;
                        return retstream;
                }