summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-05-12 07:09:17 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-05-12 07:09:17 -0400
commit1eb2dd26f33b2ad154cb5ab8bccc8cbfa5224754 (patch)
tree5714f4efed398c48e978a4345aa7e5f4e1564fff
parentb6ed90fbc3a0b033dcf68ea191a5506a7d56265b (diff)
downloadmongo-1eb2dd26f33b2ad154cb5ab8bccc8cbfa5224754.tar.gz
Don't loop on calls to deflate until Z_OK isn't returned, we're not adding
additional buffer memory so no progress can be made (in other words, a Z_OK return from deflate means compression wasn't successful).
-rw-r--r--ext/compressors/zlib/zlib_compress.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/compressors/zlib/zlib_compress.c b/ext/compressors/zlib/zlib_compress.c
index fc5ae275283..6428458bbd1 100644
--- a/ext/compressors/zlib/zlib_compress.c
+++ b/ext/compressors/zlib/zlib_compress.c
@@ -244,14 +244,14 @@ zlib_compress_raw(WT_COMPRESSOR *compressor, WT_SESSION *session,
}
zs.avail_out += WT_ZLIB_RESERVED;
- while ((ret = deflate(&zs, Z_FINISH)) == Z_OK)
- ;
+ ret = deflate(&zs, Z_FINISH);
+
/*
* If the end marker didn't fit, report that we got no work done. WT
* will compress the (possibly large) page image using ordinary
* compression instead.
*/
- if (ret == Z_BUF_ERROR)
+ if (ret == Z_OK || ret == Z_BUF_ERROR)
last_slot = 0;
else if (ret != Z_STREAM_END)
return (