• M
    Add comment to gzdopen() in zlib.h to use dup() when using fileno(). · 6dbf1d10
    Mark Adler 提交于
    A problem surfaced in a multi-threaded application where fileno() was
    used to get a file descriptor from an fopen(), which was then fed to
    gzdopen().  The problem occurred when the gzclose() followed by the
    fclose() tried to close the same file descriptor twice.  If fclose()
    were not done, there would be a memory leak.  The only way out is to
    dup() the file descriptor so that gzclose() closes the duplicated
    file descriptor, and fclose() closes the original file descriptor.
    6dbf1d10
zlib.h 82.0 KB