From 0a950a05005f94e56bd2a42b99a0961db86952db Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 30 Dec 2013 07:35:30 +0100 Subject: Sync with pecl/zip 1.12.4dev - update bunled libzip to 0.11.2 - expose zip_file_set_external_attributes + zip_file_get_external_attributes with new methods: ZipArchive::setExternalAttributesName ZipArchive::setExternalAttributesIndex ZipArchive::getExternalAttributesName ZipArchive::getExternalAttributesIndex --- ext/zip/lib/zip_dir_add.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'ext/zip/lib/zip_dir_add.c') diff --git a/ext/zip/lib/zip_dir_add.c b/ext/zip/lib/zip_dir_add.c index 0a74bd6087..1a662f4aaf 100644 --- a/ext/zip/lib/zip_dir_add.c +++ b/ext/zip/lib/zip_dir_add.c @@ -1,6 +1,6 @@ /* zip_dir_add.c -- add directory - Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at @@ -46,7 +46,7 @@ ZIP_EXTERN zip_int64_t zip_dir_add(struct zip *za, const char *name, zip_flags_t flags) { size_t len; - zip_int64_t ret; + zip_int64_t idx; char *s; struct zip_source *source; @@ -78,11 +78,18 @@ zip_dir_add(struct zip *za, const char *name, zip_flags_t flags) return -1; } - ret = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); + idx = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); free(s); - if (ret < 0) + + if (idx < 0) zip_source_free(source); + else { + if (zip_file_set_external_attributes(za, (zip_uint64_t)idx, 0, ZIP_OPSYS_DEFAULT, ZIP_EXT_ATTRIB_DEFAULT_DIR) < 0) { + zip_delete(za, (zip_uint64_t)idx); + return -1; + } + } - return ret; + return idx; } -- cgit v1.2.1