summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-27 01:51:41 +0000
committerpixel <pixel>2003-12-27 01:51:41 +0000
commit63cc0687e978f9d93ff2dd569e19c9f6a713a8bd (patch)
tree2d9b3f9c6843477a1793189ff990557b2b2ef558
parent90feaf386aad4209cba46eea0a5f1bf849af833d (diff)
Removing flusing of non writable streams
-rw-r--r--lib/Handle.cc4
-rw-r--r--lib/zlib/src/gzio.c8
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 <stdio.h>
#include <string.h>
@@ -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 <stdio.h>
@@ -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 */