You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
1.5 KiB

X-Git-Url: http://72.52.91.13:8000/?p=php-src.git;a=blobdiff_plain;f=ext%2Fbz2%2Fbz2.c;h=7cfcaa8f5883496bee6b280fcd942a1a158b3be4;hp=de3250ef7296c95c9f4e61cb7f07f7c4abba54b1;hb=f3feddb5b45b5abd93abb1a95044b7e099d51c84;hpb=e6c48213c22ed50b2b987b479fcc1ac709394caa
Index: php5-5.4.45/ext/bz2/bz2.c
===================================================================
--- php5-5.4.45.orig/ext/bz2/bz2.c 2016-08-27 23:11:18.000000000 +0200
+++ php5-5.4.45/ext/bz2/bz2.c 2016-08-27 23:11:18.000000000 +0200
@@ -137,29 +137,33 @@
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
- size_t ret;
-
- ret = BZ2_bzread(self->bz_file, buf, count);
+ int bz2_ret;
- if (ret == 0) {
+ bz2_ret = BZ2_bzread(self->bz_file, buf, count);
+
+ if (bz2_ret < 0) {
+ stream->eof = 1;
+ return -1;
+ }
+ if (bz2_ret == 0) {
stream->eof = 1;
}
- return ret;
+ return (size_t)bz2_ret;
}
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
- return BZ2_bzwrite(self->bz_file, (char*)buf, count);
+ return BZ2_bzwrite(self->bz_file, (char*)buf, count);
}
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
{
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
int ret = EOF;
-
+
if (close_handle) {
BZ2_bzclose(self->bz_file);
}