[BACK]Return to gzclose.c CVS log [TXT][DIR] Up to [local] / src / lib / libz

File: [local] / src / lib / libz / gzclose.c (download)

Revision 1.3, Tue Apr 25 16:59:10 2023 UTC (13 months, 1 week ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.2: +1 -3 lines

Update libz to the HEAD of the develop branch

This mostly moves from K&R prototypes to ANSI prototypes and includes a
handful of bug fixes that are nice to have. The corresponding sys commit
will allow us to undo some hacks that jca applied to make the kernel build
with clang 15.

discussed with deraadt

/* gzclose.c -- zlib gzclose() function
 * Copyright (C) 2004, 2010 Mark Adler
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

#include "gzguts.h"

/* gzclose() is in a separate file so that it is linked in only if it is used.
   That way the other gzclose functions can be used instead to avoid linking in
   unneeded compression or decompression routines. */
int ZEXPORT gzclose(gzFile file) {
#ifndef NO_GZCOMPRESS
    gz_statep state;

    if (file == NULL)
        return Z_STREAM_ERROR;
    state = (gz_statep)file;

    return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
#else
    return gzclose_r(file);
#endif
}