Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

zip_close (3)

Name

zip_close - close zip archive

Synopsis

#include <zip.h>

int
zip_close(zip_t *archive);

Description

ZIP_CLOSE(3)             BSD Library Functions Manual             ZIP_CLOSE(3)

NAME
     zip_close -- close zip archive

LIBRARY
     libzip (-lzip)

SYNOPSIS
     #include <zip.h>

     int
     zip_close(zip_t *archive);

DESCRIPTION
     The zip_close() function writes any changes made to archive to disk.  If
     archive contains no files, the file is completely removed (no empty ar-
     chive is written).  If successful, archive is freed.  Otherwise archive
     is left unchanged and must still be freed.

     To close and free a zip archive without saving changes, use
     zip_discard(3).

RETURN VALUES
     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
     the error code in archive is set to indicate the error.

ERRORS
     zip_close() will fail if:

     [ZIP_ER_EOF]       Unexpected end-of-file found while reading from a
                        file.

     [ZIP_ER_INTERNAL]  The callback function of an added or replaced file
                        returned an error but failed to report which.

     [ZIP_ER_INVAL]     The path argument is NULL.

     [ZIP_ER_MEMORY]    Required memory could not be allocated.

     [ZIP_ER_NOZIP]     File is not a zip archive.

     [ZIP_ER_READ]      A file read failed.

     [ZIP_ER_RENAME]    A temporary file could not be renamed to its final
                        name.

     [ZIP_ER_SEEK]      A file seek failed.

     [ZIP_ER_TMPOPEN]   A temporary file could not be created.

     [ZIP_ER_WRITE]     A file write failed.

     [ZIP_ER_ZLIB]      An error occurred while (de)compressing a stream with
                        zlib(3).
     Additionally, any errors returned by the callback function for added or
     replaced files will be passed back.


ATTRIBUTES
     See attributes(7) for descriptions of the following attributes:





     +---------------+------------------+
     |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
     +---------------+------------------+
     |Availability   | compress/libzip  |
     +---------------+------------------+
     |Stability      | Volatile         |
     +---------------+------------------+

SEE ALSO
     libzip(3), zip_discard(3), zip_fdopen(3), zip_get_error(3), zip_open(3),
     zip_register_progress_callback_with_state(3), zip_strerror(3)

HISTORY
     zip_close() was added in libzip 0.6.

AUTHORS
     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>



NOTES
     Source code for open source software components in Oracle Solaris can be
     found at https://www.oracle.com/downloads/opensource/solaris-source-code-
     downloads.html.

     This software was built from source available at https://github.com/ora-
     cle/solaris-userland.  The original community source was downloaded from
     https://libzip.org/download/libzip-1.7.3.tar.gz.

     Further information about this software can be found on the open source
     community website at https://libzip.org/.

BSD                           September 17, 2019                           BSD