List Archive


Thread Index


From: Qifei Wang <>
To: Thomas Klausner <>
Subject: Re: Failed to unzip file by zip_fdopen with the error code ZIP_ER_OPNOTSUPP
Date: Sat, 7 Sep 2019 18:09:17 -0700

Hi Thomas,

  Thanks for your reply. I figured out the problem was SEEK ( is not added as the supported operator for the zip file opened from the file descriptor. That is because the file sb.st_mode ( is not recognized as a regular file. That might be caused since the file descriptor is obtained from a content URI on Android.

  To open a zip archive from a memory buffer, should I use zip_source_buffer or zip_source_buffer_create methods?


Qifei Wang

On Sat, Sep 7, 2019 at 1:52 PM Thomas Klausner <> wrote:
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
> 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.

Made by MHonArc.