From 54f852f0948a686ae6d213f907310e358a1f1fb4 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 22 Feb 2009 02:57:15 +0000 Subject: (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. --- src/network/network_content.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 7f6dd75ae..42077ca08 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -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; -- cgit v1.2.3-54-g00ecf