]> git.lizzy.rs Git - zlib.git/blobdiff - gzlib.c
Assure that gzoffset() is correct when appending.
[zlib.git] / gzlib.c
diff --git a/gzlib.c b/gzlib.c
index fae202ef8905a3c99e4b71d756a45d55f9b1c163..ced2cb8ba74096377051f98892479ee95b537c73 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -248,8 +248,10 @@ local gzFile gz_open(path, fd, mode)
         free(state);
         return NULL;
     }
-    if (state->mode == GZ_APPEND)
+    if (state->mode == GZ_APPEND) {
+        LSEEK(state->fd, 0, SEEK_END);  /* so gzoffset() is correct */
         state->mode = GZ_WRITE;         /* simplify later checks */
+    }
 
     /* save the current position for rewinding (only if reading) */
     if (state->mode == GZ_READ) {