(svn r15552) -Fix (r15544): some compiler/OS combinations don't like closing the same FD twice and zlib's docs weren't very clear about whether it would close a FD it didn't open.

This commit is contained in:
rubidium 2009-02-22 02:57:15 +00:00
parent 731c1e90e8
commit 54f852f094
1 changed files with 8 additions and 2 deletions

View File

@ -324,8 +324,14 @@ static bool GunzipFile(const ContentInfo *ci)
}
exit:
if (fin != NULL) gzclose(fin);
if (ftmp != NULL) fclose(ftmp);
if (fin != NULL) {
/* Closes ftmp too! */
gzclose(fin);
} else if (ftmp != NULL) {
/* In case the gz stream was opened correctly this will
* be closed by gzclose. */
fclose(ftmp);
}
if (fout != NULL) fclose(fout);
return ret;