aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Taïbi <oli@olitb.net>2020-04-14 19:38:40 +0200
committerDavid Bremner <david@tethera.net>2020-04-16 07:55:23 -0300
commitb4f593e0e6288666e64d4f3d2651076f5eef1074 (patch)
tree620ebd5ac548a979aea35101097b001861d912b0
parent8c718a8190eb0820b5e3891b4643c99da50d0c08 (diff)
util: after gzgets(), Z_STREAM_END means EOF, not error
Context: I am compiling notmuch on OpenBSD which has a rather old zlib 1.2.3. It seems that the behaviour of gzgets() changed slightly between this version and more recent versions, but the manual does not reflect that change. Note that zlib's manual: - does not specify which error code (Z_OK or Z_STREAM_END) is set when EOF is reached, - does not indicate the meaning of Z_STREAM_END after gzgets(), but based on its meaning as a possible return value of inflate(), I would guess that it means EOF. amended by db: tidy commit message
-rw-r--r--util/zlib-extra.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/zlib-extra.c b/util/zlib-extra.c
index 623f6d62..2d2d2414 100644
--- a/util/zlib-extra.c
+++ b/util/zlib-extra.c
@@ -47,6 +47,7 @@ gz_getline (void *talloc_ctx, char **bufptr, ssize_t *bytes_read, gzFile stream)
int zlib_status = 0;
(void) gzerror (stream, &zlib_status);
switch (zlib_status) {
+ case Z_STREAM_END:
case Z_OK:
/* no data read before EOF */
if (offset == 0)