diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:27:26 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:27:26 -0700 |
commit | 7751bd4c715ea8478113e34b49b5a794a4642e8e (patch) | |
tree | 537ba82b3780f933c2f17028febd6fe3a2332190 /gzlib.c | |
parent | e0ff940e1adb68d3575705ebf1546d9f07ad3b4a (diff) | |
download | zlib-7751bd4c715ea8478113e34b49b5a794a4642e8e.tar.gz |
zlib 1.2.3.9v1.2.3.9
Diffstat (limited to 'gzlib.c')
-rw-r--r-- | gzlib.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -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:%d>", fd); /* big enough for 128-bit integers */ -#else - snprintf(path, sizeof(path), "<fd:%d>", fd); -#endif - return gz_open(path, fd, mode); + sprintf(path, "<fd:%d>", 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 */ |