diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/htszlib.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/htszlib.c b/src/htszlib.c index 5042910..05cc457 100644 --- a/src/htszlib.c +++ b/src/htszlib.c @@ -59,8 +59,9 @@ int hts_zunpack(char *filename, char *newfile) { char catbuff[CATBUFF_SIZE]; FILE *const in = FOPEN(fconv(catbuff, sizeof(catbuff), filename), "rb"); const int fd = in != NULL ? fileno(in) : -1; + const int dup_fd = fd != -1 ? dup(fd) : -1; // Note: we must dup to be able to flose cleanly. - gzFile gz = fd != -1 ? gzdopen(dup(fd), "rb") : NULL; + const gzFile gz = dup_fd != -1 ? gzdopen(dup_fd, "rb") : NULL; if (gz) { FILE *const fpout = FOPEN(fconv(catbuff, sizeof(catbuff), newfile), "wb"); |