diff options
author | Wez Furlong <wez@php.net> | 2002-10-15 16:01:00 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2002-10-15 16:01:00 +0000 |
commit | 30f9c47d615aa2375b2272567c4a226e928fe61f (patch) | |
tree | e997f191859ded7ad1a9c4dca9cc32f79d4565b2 /ext/zlib/zlib_fopen_wrapper.c | |
parent | 57440cc9842901d43e7550401cd42874f6b3c56e (diff) | |
download | php-git-30f9c47d615aa2375b2272567c4a226e928fe61f.tar.gz |
Fix for 19906.
gzeof has different semantics from feof, in that gzeof will return true
if the read position is at EOF, even if the most recent read was 100%
successful.
feof will return true only (usually) if the most recent fread failed.
Diffstat (limited to 'ext/zlib/zlib_fopen_wrapper.c')
-rw-r--r-- | ext/zlib/zlib_fopen_wrapper.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c index b7c5454a37..b0855ddd20 100644 --- a/ext/zlib/zlib_fopen_wrapper.c +++ b/ext/zlib/zlib_fopen_wrapper.c @@ -35,8 +35,8 @@ static size_t php_gziop_read(php_stream *stream, char *buf, size_t count TSRMLS_ size_t ret; ret = gzread(self->gz_file, buf, count); - - if (ret == 0 && gzeof(self->gz_file)) + + if (gzeof(self->gz_file)) stream->eof = 1; return ret; @@ -45,7 +45,7 @@ static size_t php_gziop_read(php_stream *stream, char *buf, size_t count TSRMLS_ static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *)stream->abstract; - return gzwrite(self->gz_file, (char*)buf, count); + return gzwrite(self->gz_file, (char*)buf, count); } static int php_gziop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) @@ -66,8 +66,9 @@ static int php_gziop_close(php_stream *stream, int close_handle TSRMLS_DC) struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *)stream->abstract; int ret = EOF; - if (close_handle) + if (close_handle) { ret = gzclose(self->gz_file); + } php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | (close_handle == 0 ? PHP_STREAM_FREE_PRESERVE_HANDLE : 0)); efree(self); |