Skip to content

Error when creating .zip files with libzip #36

@bucanero

Description

@bucanero

I found a problem while using the ported libzip 0.9.3 when creating a .zip file from within a ps3 homebrew app:
When you try to create an archive.zip, libzip ends up creating archive.zip.XXXXX (where XXXXX is a random extension)

I tracked down the issue back to the libzip source code, and fixed it. The libzip code creates a temp file and when it finishes, it tries to rename it to the desired filename, e.g. archive.zip.

The fix I made was to re-define the _zip_rename() to sysLv2FsRename() in ./libzip-0.9.3/lib/zipint.h:

#ifdef HAVE_MOVEFILEEXA
#include <windows.h>
#define _zip_rename(s, t)						\
	(!MoveFileExA((s), (t),						\
		     MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING))
#else
#include <sys/file.h>
#define _zip_rename	sysLv2FsRename
#endif

I don't know how to properly share this patch, so I'm attaching the whole zipint.h file to this issue: zipint.h.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions