aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_set_format_zip.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2012-02-25 00:16:00 +0000
committerMartin Matuska <mm@FreeBSD.org>2012-02-25 00:16:00 +0000
commit132160f77407d2174d2bec0a8ba9c6eefc4429d7 (patch)
tree2668d05088fbc82cf0170e53f56d547365926031 /libarchive/archive_write_set_format_zip.c
parent4d44c8d1829cfdaa134c3f88cad04f0c73b47ad8 (diff)
downloadsrc-132160f77407d2174d2bec0a8ba9c6eefc4429d7.tar.gz
src-132160f77407d2174d2bec0a8ba9c6eefc4429d7.zip
Update libarchive's vendor dist to latest changes in release branch.
Git branch: release Git commit: e2cc36190d7d733b3ac6744ec860d09776c9da02 Obtained from: https://github.com/libarchive/libarchive.git
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=232133
Diffstat (limited to 'libarchive/archive_write_set_format_zip.c')
-rw-r--r--libarchive/archive_write_set_format_zip.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c
index f07a14f47f5a..3801ce1fa5ac 100644
--- a/libarchive/archive_write_set_format_zip.c
+++ b/libarchive/archive_write_set_format_zip.c
@@ -1,7 +1,7 @@
/*-
* Copyright (c) 2008 Anselm Strauss
* Copyright (c) 2009 Joerg Sonnenberger
- * Copyright (c) 2011 Michihiro NAKAJIMA
+ * Copyright (c) 2011-2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -238,6 +238,7 @@ archive_write_zip_options(struct archive_write *a, const char *key,
zip->compression = COMPRESSION_STORE;
ret = ARCHIVE_OK;
}
+ return (ret);
} else if (strcmp(key, "hdrcharset") == 0) {
if (val == NULL || val[0] == 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
@@ -251,10 +252,13 @@ archive_write_zip_options(struct archive_write *a, const char *key,
else
ret = ARCHIVE_FATAL;
}
- } else
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "%s: unknown keyword ``%s''", a->format_name, key);
- return (ret);
+ return (ret);
+ }
+
+ /* Note: The "warn" return is just to inform the options
+ * supervisor that we didn't handle it. It will generate
+ * a suitable error if no one used this option. */
+ return (ARCHIVE_WARN);
}
int
@@ -381,7 +385,21 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
"Can't allocate zip header data");
return (ARCHIVE_FATAL);
}
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Make sure the path separators in pahtname, hardlink and symlink
+ * are all slash '/', not the Windows path separator '\'. */
+ l->entry = __la_win_entry_in_posix_pathseparator(entry);
+ if (l->entry == entry)
+ l->entry = archive_entry_clone(entry);
+#else
l->entry = archive_entry_clone(entry);
+#endif
+ if (l->entry == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate zip header data");
+ free(l);
+ return (ARCHIVE_FATAL);
+ }
l->flags = zip->flags;
if (zip->opt_sconv != NULL)
sconv = zip->opt_sconv;