diff options
author | Remi Collet <remi@php.net> | 2013-12-30 07:35:30 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2013-12-30 07:35:30 +0100 |
commit | 0a950a05005f94e56bd2a42b99a0961db86952db (patch) | |
tree | 3949553a3f889947795b007df4776643b153da55 /ext/zip/lib/zip_dir_add.c | |
parent | 5a756afcf14fada75f6ed8052cd97924dd229ed8 (diff) | |
download | php-git-0a950a05005f94e56bd2a42b99a0961db86952db.tar.gz |
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
Diffstat (limited to 'ext/zip/lib/zip_dir_add.c')
-rw-r--r-- | ext/zip/lib/zip_dir_add.c | 17 |
1 files changed, 12 insertions, 5 deletions
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 <libzip@nih.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; } |