List Archive

Thread

Thread Index

Message

From: Thomas Klausner <tk%giga.or.at@localhost>
To: Qifei Wang <qfwang%google.com@localhost>
Subject: Re: Failed to unzip file by zip_fdopen with the error code ZIP_ER_OPNOTSUPP
Date: Sat, 7 Sep 2019 22:52:48 +0200

On Fri, Sep 06, 2019 at 06:03:06PM -0700, Qifei Wang wrote:
>   I am trying to unzip a zip file from file descriptor by the following
> code snippet. It reports the error ZIP_ER_OPNOTSUPP. The file descriptor is
> valid. The error seems reported by zip_open_from_source() method. See
> https://github.com/nih-at/libzip/blob/master/lib/zip_open.c#L106. Any idea
> about this?

I see one location that actually does set that error:

    if ((st.valid & ZIP_STAT_SIZE) == 0) {
        zip_error_set(error, ZIP_ER_SEEK, EOPNOTSUPP);
        return NULL;
    }

For reading an archive, libzip starts at the end and parses the
EOCD(64) marker and then the central directory. Perhaps the stat() to
find out the filesize failed?

You could read the file from the server into a memory buffer and open
the zip archive from there.
 Thomas

Made by MHonArc.