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

NAME

4     zip_close — close zip archive
5

LIBRARY

7     libzip (-lzip)
8

SYNOPSIS

10     #include <zip.h>
11
12     int
13     zip_close(zip_t *archive);
14

DESCRIPTION

16     The zip_close() function writes any changes made to archive to disk.  If
17     archive contains no files, the file is completely removed (no empty ar‐
18     chive is written).  If successful, archive is freed.  Otherwise archive
19     is left unchanged and must still be freed.
20
21     To close and free a zip archive without saving changes, use
22     zip_discard(3).
23

RETURN VALUES

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

ERRORS

29     zip_close() will fail if:
30
31     [ZIP_ER_EOF]       Unexpected end-of-file found while reading from a
32                        file.
33
34     [ZIP_ER_INTERNAL]  The callback function of an added or replaced file
35                        returned an error but failed to report which.
36
37     [ZIP_ER_INVAL]     The path argument is NULL.
38
39     [ZIP_ER_MEMORY]    Required memory could not be allocated.
40
41     [ZIP_ER_NOZIP]     File is not a zip archive.
42
43     [ZIP_ER_READ]      A file read failed.
44
45     [ZIP_ER_RENAME]    A temporary file could not be renamed to its final
46                        name.
47
48     [ZIP_ER_SEEK]      A file seek failed.
49
50     [ZIP_ER_TMPOPEN]   A temporary file could not be created.
51
52     [ZIP_ER_WRITE]     A file write failed.
53
54     [ZIP_ER_ZLIB]      An error occurred while (de)compressing a stream with
55                        zlib(3).
56     Additionally, any errors returned by the callback function for added or
57     replaced files will be passed back.
58

SEE ALSO

60     libzip(3), zip_discard(3), zip_fdopen(3), zip_get_error(3), zip_open(3),
61     zip_register_progress_callback_with_state(3), zip_strerror(3)
62

HISTORY

64     zip_close() was added in libzip 0.6.
65

AUTHORS

67     Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
68
69BSD                           September 17, 2019                           BSD
Impressum