ZIP_FDOPEN(3)
π ZIP_FDOPEN(3) π
okay bestie, gather round β this is the zip_fdopen page from the Library Functions Manual, and it's literally the shortcut for "I already have an open file descriptor, just zip it open for me" π«Ά
β¨ NAME β¨
zip_fdopen β open zip archive using open file descriptor πΈ
π LIBRARY π
libzip (-lzip) β that's the one, no cap π
π SYNOPSIS π
#include <zip.h>
zip_t *
zip_fdopen(int fd, int flags, int *errorp);
π DESCRIPTION π
So here's the vibe: the zip archive that your open file descriptor fd points at gets opened, and you get back a pointer to a struct zip β that's the lil handle you use to actually mess with the archive β¨
But bestie, listen: unlike zip_open(3), when you come through zip_fdopen the archive can only be opened in read-only mode. That's just the deal. π
Also, the fd argument may not be used any longer after calling zip_fdopen β like, it's been claimed, it's got main character energy now, hands off π
The flags are specified by or'ing the following values, or 0 for none of them:
ZIP_CHECKCONSβ do extra stricter consistency checks on the archive, and error out if they fail π
If an error happens and errorp is non-NULL, it gets set to the corresponding error code. Simple as that.
π RETURN VALUES π
On the happy path, zip_fdopen() returns a struct zip pointer, and fd should not be used any longer β nor passed to close(2) β οΈ (fr fr, don't do it).
Otherwise you get NULL back and *errorp is set to indicate the error. And in the error case, fd remains unchanged β so it's not just gone, okay? π«Ά
π ERRORS π
The file specified by fd is prepared for use by libzip(3) unless:
[ZIP_ER_INCONS]β Inconsistencies were found in the file specified bypath. This error is often caused by specifyingZIP_CHECKCONSbut can also happen without it π[ZIP_ER_INVAL]β Theflagsargument is invalid. Not allzip_open(3)flags are allowed forzip_fdopen, see "DESCRIPTION" π[ZIP_ER_MEMORY]β Required memory could not be allocated π[ZIP_ER_NOZIP]β The file specified byfdis not a zip archive π[ZIP_ER_OPEN]β The file specified byfdcould not be prepared for use bylibzip(3)[ZIP_ER_OPNOTSUPP]β This functionality has been disabled at compile time π«[ZIP_ER_READ]β A read error occurred; seeerrnofor details[ZIP_ER_SEEK]β The file specified byfddoes not allow seeks π
π SEE ALSO π
libzip(3), zip_close(3), zip_error_strerror(3), zip_open(3)
π¦ HISTORY π¦
zip_fdopen() was added in libzip 1.0 β vintage, honestly π
π AUTHORS π
Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β icons, we thank them π«Ά
k bye, this page came from the Debian crew on September 23, 2022, and that's the whole tea πβ¨
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- debian trixie: libzip-dev 1.11.3-2 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu questing: libzip-dev 1.11.3-2
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2009-2021 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms