You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about that? My interpretation from the man-page is that the zip handle needs to be discarded explicetely if zip_close failed:
The zip_close() function writes any changes made to archive to disk. If archive contains no files, the file is completely removed (no empty archive 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).
The reason will be displayed to describe this comment to others. Learn more.
In this case we need to find how to detect if zip_discard is present at compilation time. There are at least 3 versions of libzip to support and zip_discard was added in libzip 0.11 and there is no way to detect that version.
1389dcf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about that? My interpretation from the man-page is that the zip handle needs to be discarded explicetely if
zip_close
failed:1389dcf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we need to find how to detect if zip_discard is present at compilation time. There are at least 3 versions of libzip to support and zip_discard was added in libzip 0.11 and there is no way to detect that version.
1389dcf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at
/usr/include/x86_64-linux-gnu/zipconf.h
(the actual path might depend on the distro/arch) which is included fromzip.h
:So this should work for
zip_discard
as well as for other compat issues (e.g.LIBZIP_VERSION_MAJOR >= 1
forzip_error_init_with_code
):1389dcf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know about that file and those variables. I overlooked the fact they were defined in 0.11 as they weren't in 0.10 and 0.9.
Do a small PR and I'll merge it.