From 63cc0687e978f9d93ff2dd569e19c9f6a713a8bd Mon Sep 17 00:00:00 2001 From: pixel Date: Sat, 27 Dec 2003 01:51:41 +0000 Subject: Removing flusing of non writable streams --- lib/Handle.cc | 4 +++- lib/zlib/src/gzio.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Handle.cc b/lib/Handle.cc index 6fa4e54..3d60fda 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.66 2003-12-26 23:51:33 pixel Exp $ */ +/* $Id: Handle.cc,v 1.67 2003-12-27 01:51:41 pixel Exp $ */ #include #include @@ -543,6 +543,8 @@ void copy(Handle * s, Handle * d, ssize_t size) { } void Handle::Flush() { + if (!CanWrite()) + return; if (h < 0) return; if (z >= 10) { diff --git a/lib/zlib/src/gzio.c b/lib/zlib/src/gzio.c index 3c861fd..fed1ffa 100644 --- a/lib/zlib/src/gzio.c +++ b/lib/zlib/src/gzio.c @@ -5,7 +5,7 @@ * Compile this file with -DNO_DEFLATE to avoid the compression code. */ -/* @(#) $Id: gzio.c,v 1.2 2003-10-09 04:47:27 pixel Exp $ */ +/* @(#) $Id: gzio.c,v 1.3 2003-12-27 01:51:41 pixel Exp $ */ #include @@ -605,7 +605,11 @@ local int do_flush (file, flush) int done = 0; gz_stream *s = (gz_stream*)file; - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + if (s == NULL) + return Z_STREAM_ERROR; + else + if (s->mode != 'w') + return Z_STREAM_ERROR; s->stream.avail_in = 0; /* should be zero already anyway */ -- cgit v1.2.3