summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-03-22 01:17:52 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-03-22 01:17:52 +0000
commitce398b2278d345707ad20b76cf2ec770188eecce (patch)
treed994b4c75997e1a176d87ae37c81212f60876fb3
parentb61e6df9f3ef2617af9cb81f32ec5256a1185d35 (diff)
- markus@cvs.openbsd.org 2002/03/16 11:24:53
[compress.c] skip inflateEnd if inflate fails; ok provos@
-rw-r--r--ChangeLog5
-rw-r--r--compress.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2c670f358..24af78316 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,9 @@
21 - itojun@cvs.openbsd.org 2002/03/15 11:00:38 21 - itojun@cvs.openbsd.org 2002/03/15 11:00:38
22 [auth.c] 22 [auth.c]
23 fix file type checking (use S_ISREG). ok by markus 23 fix file type checking (use S_ISREG). ok by markus
24 - markus@cvs.openbsd.org 2002/03/16 11:24:53
25 [compress.c]
26 skip inflateEnd if inflate fails; ok provos@
24 27
2520020317 2820020317
26 - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted, 29 - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
@@ -7867,4 +7870,4 @@
7867 - Wrote replacements for strlcpy and mkdtemp 7870 - Wrote replacements for strlcpy and mkdtemp
7868 - Released 1.0pre1 7871 - Released 1.0pre1
7869 7872
7870$Id: ChangeLog,v 1.1930 2002/03/22 01:15:33 mouring Exp $ 7873$Id: ChangeLog,v 1.1931 2002/03/22 01:17:52 mouring Exp $
diff --git a/compress.c b/compress.c
index 3badbf452..e2efa6846 100644
--- a/compress.c
+++ b/compress.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: compress.c,v 1.17 2001/12/29 21:56:01 stevesk Exp $"); 15RCSID("$OpenBSD: compress.c,v 1.18 2002/03/16 11:24:53 markus Exp $");
16 16
17#include "log.h" 17#include "log.h"
18#include "buffer.h" 18#include "buffer.h"
@@ -23,6 +23,8 @@ static z_stream incoming_stream;
23static z_stream outgoing_stream; 23static z_stream outgoing_stream;
24static int compress_init_send_called = 0; 24static int compress_init_send_called = 0;
25static int compress_init_recv_called = 0; 25static int compress_init_recv_called = 0;
26static int inflate_failed = 0;
27static int deflate_failed = 0;
26 28
27/* 29/*
28 * Initializes compression; level is compression level from 1 to 9 30 * Initializes compression; level is compression level from 1 to 9
@@ -62,9 +64,9 @@ buffer_compress_uninit(void)
62 incoming_stream.total_out, incoming_stream.total_in, 64 incoming_stream.total_out, incoming_stream.total_in,
63 incoming_stream.total_out == 0 ? 0.0 : 65 incoming_stream.total_out == 0 ? 0.0 :
64 (double) incoming_stream.total_in / incoming_stream.total_out); 66 (double) incoming_stream.total_in / incoming_stream.total_out);
65 if (compress_init_recv_called == 1) 67 if (compress_init_recv_called == 1 && inflate_failed == 0)
66 inflateEnd(&incoming_stream); 68 inflateEnd(&incoming_stream);
67 if (compress_init_send_called == 1) 69 if (compress_init_send_called == 1 && deflate_failed == 0)
68 deflateEnd(&outgoing_stream); 70 deflateEnd(&outgoing_stream);
69} 71}
70 72
@@ -106,6 +108,7 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
106 sizeof(buf) - outgoing_stream.avail_out); 108 sizeof(buf) - outgoing_stream.avail_out);
107 break; 109 break;
108 default: 110 default:
111 deflate_failed = 1;
109 fatal("buffer_compress: deflate returned %d", status); 112 fatal("buffer_compress: deflate returned %d", status);
110 /* NOTREACHED */ 113 /* NOTREACHED */
111 } 114 }
@@ -149,6 +152,7 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer)
149 */ 152 */
150 return; 153 return;
151 default: 154 default:
155 inflate_failed = 1;
152 fatal("buffer_uncompress: inflate returned %d", status); 156 fatal("buffer_uncompress: inflate returned %d", status);
153 /* NOTREACHED */ 157 /* NOTREACHED */
154 } 158 }