aboutsummaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/zlib.h b/zlib.h
index 14a925b..d85d7c2 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1233,7 +1233,11 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
1233 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor 1233 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
1234 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, 1234 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
1235 mode);. The duplicated descriptor should be saved to avoid a leak, since 1235 mode);. The duplicated descriptor should be saved to avoid a leak, since
1236 gzdopen does not close fd if it fails. 1236 gzdopen does not close fd if it fails. If you are using fileno() to get the
1237 file descriptor from a FILE *, then you will have to use dup() to avoid
1238 double-close()ing the file descriptor. Both gzclose() and fclose() will
1239 close the associated file descriptor, so they need to have different file
1240 descriptors.
1237 1241
1238 gzdopen returns NULL if there was insufficient memory to allocate the 1242 gzdopen returns NULL if there was insufficient memory to allocate the
1239 gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not 1243 gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not