提交 0cf495a1 编写于 作者: M Mark Adler

Fix bug where gzopen(), gzclose() would write an empty file.

A gzopen() to write (mode "w") followed immediately by a gzclose()
would output an empty zero-length file.  What it should do is write
an empty gzip file, with the gzip header, empty deflate content,
and gzip trailer totalling 20 bytes.  This fixes it to do that.
上级 bd143f1c
......@@ -554,15 +554,14 @@ int ZEXPORT gzclose_w(file)
}
/* flush, free memory, and close file */
if (state->size) {
if (gz_comp(state, Z_FINISH) == -1)
ret = state->err;
if (!state->direct) {
(void)deflateEnd(&(state->strm));
free(state->out);
}
free(state->in);
if (gz_comp(state, Z_FINISH) == -1)
ret = state->err;
if (!state->direct) {
(void)deflateEnd(&(state->strm));
free(state->out);
}
if (state->size)
free(state->in);
gz_error(state, Z_OK, NULL);
free(state->path);
if (close(state->fd) == -1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册