summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-21 17:01:30 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-21 17:01:30 +0000
commit72e0c0601b75930c34ace84347459700fa2ae257 (patch)
tree0aabf0455553310f32304770294ea285ef0d2a49 /src
parentb72741ddc95143bd62545d18751b9a1eeb7c02dd (diff)
Cleaner dup
Diffstat (limited to 'src')
-rw-r--r--src/htszlib.c3
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");