[compress.c]
     skip inflateEnd if inflate fails; ok provos@
This commit is contained in:
Ben Lindstrom 2002-03-22 01:17:52 +00:00
parent b61e6df9f3
commit ce398b2278
2 changed files with 11 additions and 4 deletions

View File

@ -21,6 +21,9 @@
- itojun@cvs.openbsd.org 2002/03/15 11:00:38 - itojun@cvs.openbsd.org 2002/03/15 11:00:38
[auth.c] [auth.c]
fix file type checking (use S_ISREG). ok by markus fix file type checking (use S_ISREG). ok by markus
- markus@cvs.openbsd.org 2002/03/16 11:24:53
[compress.c]
skip inflateEnd if inflate fails; ok provos@
20020317 20020317
- (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted, - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
@ -7867,4 +7870,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1930 2002/03/22 01:15:33 mouring Exp $ $Id: ChangeLog,v 1.1931 2002/03/22 01:17:52 mouring Exp $

View File

@ -12,7 +12,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: compress.c,v 1.17 2001/12/29 21:56:01 stevesk Exp $"); RCSID("$OpenBSD: compress.c,v 1.18 2002/03/16 11:24:53 markus Exp $");
#include "log.h" #include "log.h"
#include "buffer.h" #include "buffer.h"
@ -23,6 +23,8 @@ static z_stream incoming_stream;
static z_stream outgoing_stream; static z_stream outgoing_stream;
static int compress_init_send_called = 0; static int compress_init_send_called = 0;
static int compress_init_recv_called = 0; static int compress_init_recv_called = 0;
static int inflate_failed = 0;
static int deflate_failed = 0;
/* /*
* Initializes compression; level is compression level from 1 to 9 * Initializes compression; level is compression level from 1 to 9
@ -62,9 +64,9 @@ buffer_compress_uninit(void)
incoming_stream.total_out, incoming_stream.total_in, incoming_stream.total_out, incoming_stream.total_in,
incoming_stream.total_out == 0 ? 0.0 : incoming_stream.total_out == 0 ? 0.0 :
(double) incoming_stream.total_in / incoming_stream.total_out); (double) incoming_stream.total_in / incoming_stream.total_out);
if (compress_init_recv_called == 1) if (compress_init_recv_called == 1 && inflate_failed == 0)
inflateEnd(&incoming_stream); inflateEnd(&incoming_stream);
if (compress_init_send_called == 1) if (compress_init_send_called == 1 && deflate_failed == 0)
deflateEnd(&outgoing_stream); deflateEnd(&outgoing_stream);
} }
@ -106,6 +108,7 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
sizeof(buf) - outgoing_stream.avail_out); sizeof(buf) - outgoing_stream.avail_out);
break; break;
default: default:
deflate_failed = 1;
fatal("buffer_compress: deflate returned %d", status); fatal("buffer_compress: deflate returned %d", status);
/* NOTREACHED */ /* NOTREACHED */
} }
@ -149,6 +152,7 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer)
*/ */
return; return;
default: default:
inflate_failed = 1;
fatal("buffer_uncompress: inflate returned %d", status); fatal("buffer_uncompress: inflate returned %d", status);
/* NOTREACHED */ /* NOTREACHED */
} }