wez Tue Oct 15 12:01:02 2002 EDT Modified files: /php4/ext/zlib zlib_fopen_wrapper.c Log: 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. Index: php4/ext/zlib/zlib_fopen_wrapper.c diff -u php4/ext/zlib/zlib_fopen_wrapper.c:1.32 php4/ext/zlib/zlib_fopen_wrapper.c:1.33 --- php4/ext/zlib/zlib_fopen_wrapper.c:1.32 Mon Oct 14 22:27:15 2002 +++ php4/ext/zlib/zlib_fopen_wrapper.c Tue Oct 15 12:01:00 2002 @@ -16,7 +16,7 @@ | Hartmut Holzgraefe <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: zlib_fopen_wrapper.c,v 1.32 2002/10/15 02:27:15 wez Exp $ */ +/* $Id: zlib_fopen_wrapper.c,v 1.33 2002/10/15 16:01:00 wez Exp $ */ #define IS_EXT_MODULE #define _GNU_SOURCE @@ -35,8 +35,8 @@ 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_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 @@ 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);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php