Skip to content

Commit

Permalink
MFH: add PHP_STREAM_FLAG_FCLOSE, bz2 streams can be closed with fclose()
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Jul 23, 2008
1 parent 15b1c9a commit 0c9d42b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/bz2/bz2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
}

Expand Down

0 comments on commit 0c9d42b

Please sign in to comment.