forked from Mirrors/openclonk
Fix possible double close when attempting to open uncompressed files
parent
fb27b9c1c3
commit
2092baaa18
|
@ -126,6 +126,14 @@ bool CStdFile::Open(const char *szFilename, bool fCompressed)
|
||||||
|
|
||||||
if(fd == -1) return false;
|
if(fd == -1) return false;
|
||||||
if (!(hgzFile = c4_gzdopen(fd,"rb"))) { close(fd); return false; }
|
if (!(hgzFile = c4_gzdopen(fd,"rb"))) { close(fd); return false; }
|
||||||
|
|
||||||
|
/* Reject uncompressed files */
|
||||||
|
if(c4_gzdirect(hgzFile))
|
||||||
|
{
|
||||||
|
c4_gzclose(hgzFile);
|
||||||
|
hgzFile = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,13 +208,6 @@ local gzFile gz_open (path, mode, fd)
|
||||||
s->start = ftell(s->file) - s->stream.avail_in;
|
s->start = ftell(s->file) - s->stream.avail_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reject uncompressed files */
|
|
||||||
if (s->transparent)
|
|
||||||
{
|
|
||||||
gzclose( (gzFile)s );
|
|
||||||
return (gzFile)Z_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (gzFile)s;
|
return (gzFile)s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue