Skip to content

Commit 67f7c81

Browse files
Fix buf error on interrupt.
1 parent 957a6a3 commit 67f7c81

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ext/zlib/zlib.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,9 +1173,11 @@ zstream_run_try(VALUE value_arg)
11731173
goto loop;
11741174
}
11751175

1176-
if (flush != Z_FINISH && err == Z_BUF_ERROR
1177-
&& z->stream.avail_out > 0) {
1178-
z->flags |= ZSTREAM_FLAG_IN_STREAM;
1176+
if (flush != Z_FINISH && err == Z_BUF_ERROR && z->stream.avail_out > 0) {
1177+
z->flags |= ZSTREAM_FLAG_IN_STREAM;
1178+
1179+
/* Z_BUF_ERROR with avail_out > 0 is a valid state - don't raise error */
1180+
err = Z_OK;
11791181
}
11801182

11811183
zstream_reset_input(z);

0 commit comments

Comments
 (0)