From: Antony Dovgal Date: Wed, 23 Jul 2008 08:56:29 +0000 (+0000) Subject: MFH: add PHP_STREAM_FLAG_FCLOSE, bz2 streams can be closed with fclose() X-Git-Tag: php-5.3.0alpha1~195 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c9d42bfdeb2517bc0c6450c7abdc9adaf8c8f88;p=php MFH: add PHP_STREAM_FLAG_FCLOSE, bz2 streams can be closed with fclose() --- diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index e65d34d93c..e4cbb1902f 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -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; }