summaryrefslogtreecommitdiff
path: root/ext/phar/util.c
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-04-09 19:23:31 +0000
committerGreg Beaver <cellog@php.net>2008-04-09 19:23:31 +0000
commitabfc228f36db9a98df6795ba5eeeef143006c828 (patch)
treec05b7cd2a83440268e4ce71be37eb697da7292dd /ext/phar/util.c
parentf6df935264bd3ccedd838f540f93f9105707af88 (diff)
downloadphp-git-abfc228f36db9a98df6795ba5eeeef143006c828.tar.gz
add addFile/addFromString/addEmptyDir. API is identical to ext/zip
[DOC]
Diffstat (limited to 'ext/phar/util.c')
-rw-r--r--ext/phar/util.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 6c496650a8..0791bb0ebb 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -436,7 +436,7 @@ int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char
return FAILURE;
}
if (allow_dir) {
- if ((entry = phar_get_entry_info_dir(phar, path, path_len, 2, for_create && !PHAR_G(readonly) && !phar->is_data ? NULL : error TSRMLS_CC)) == NULL) {
+ if ((entry = phar_get_entry_info_dir(phar, path, path_len, allow_dir, for_create && !PHAR_G(readonly) && !phar->is_data ? NULL : error TSRMLS_CC)) == NULL) {
if (for_create && (!PHAR_G(readonly) || phar->is_data)) {
return SUCCESS;
}
@@ -564,11 +564,13 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char
}
etemp.fp_refcount = 1;
- if (is_dir) {
+ if (allow_dir == 2) {
etemp.is_dir = 1;
etemp.flags = etemp.old_flags = PHAR_ENT_PERM_DEF_DIR;
- etemp.filename_len--; /* strip trailing / */
- path_len--;
+ if (is_dir) {
+ etemp.filename_len--; /* strip trailing / */
+ path_len--;
+ }
} else {
etemp.flags = etemp.old_flags = PHAR_ENT_PERM_DEF_FILE;
}
@@ -1015,7 +1017,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
}
return NULL;
}
- if (!entry->is_dir && is_dir) {
+ if (!entry->is_dir && dir == 2) {
/* user requested a directory, we must return one */
if (error) {
spprintf(error, 4096, "phar error: path \"%s\" exists and is a not a directory", path);