From 7751bd4c715ea8478113e34b49b5a794a4642e8e Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Fri, 9 Sep 2011 23:27:26 -0700 Subject: zlib 1.2.3.9 --- gzlib.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'gzlib.c') diff --git a/gzlib.c b/gzlib.c index fec283f..03240b1 100644 --- a/gzlib.c +++ b/gzlib.c @@ -3,8 +3,6 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifndef OLD_GZIO - #include "gzguts.h" #ifdef _LARGEFILE64_SOURCE @@ -214,16 +212,15 @@ gzFile ZEXPORT gzdopen(fd, mode) int fd; const char *mode; { - char path[46]; /* identifier for error messages */ + char *path; /* identifier for error messages */ + gzFile gz; - if (fd == -1) + if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) return NULL; -#ifdef NO_snprintf - sprintf(path, "", fd); /* big enough for 128-bit integers */ -#else - snprintf(path, sizeof(path), "", fd); -#endif - return gz_open(path, fd, mode); + sprintf(path, "", fd); + gz = gz_open(path, fd, mode); + free(path); + return gz; } /* -- see zlib.h -- */ @@ -301,6 +298,9 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* normalize offset to a SEEK_CUR specification */ if (whence == SEEK_SET) offset -= state->pos; + else if (state->seek) + offset += state->skip; + state->seek = 0; /* if within raw area while reading, just go there */ if (state->mode == GZ_READ && state->how == COPY && @@ -532,5 +532,3 @@ unsigned ZEXPORT gz_intmax() return q >> 1; } #endif - -#endif /* !OLD_GZIO */ -- cgit v1.2.3-55-g6feb