aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/zip_main.cc
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-06-29 11:06:50 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-06-29 16:39:52 +0000
commit0cd6dfb85f930275d486104b380c60ae13f4ee46 (patch)
tree9c90efdd7bb3d12ba462ac329b7615ef210b5f8e /third_party/ijar/zip_main.cc
parentda48d0b5c6abb90a772a9a2aa12e3701c0064f41 (diff)
Ijar's zipper: fallback when external attributes is unset
Some ZIP files does not define external attributes leading to wrong uncompression by the zipper of ijar. -- MOS_MIGRATED_REVID=97117828
Diffstat (limited to 'third_party/ijar/zip_main.cc')
-rw-r--r--third_party/ijar/zip_main.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/third_party/ijar/zip_main.cc b/third_party/ijar/zip_main.cc
index 11b0c06f58..cd5c2f39be 100644
--- a/third_party/ijar/zip_main.cc
+++ b/third_party/ijar/zip_main.cc
@@ -115,6 +115,11 @@ void UnzipProcessor::Process(const char* filename, const u4 attr,
mode_t mode = zipattr_to_mode(attr);
mode_t perm = mode & 0777;
bool isdir = (mode & S_IFDIR) != 0;
+ if (attr == 0) {
+ // Fallback when the external attribute is not set.
+ isdir = filename[strlen(filename)-1] == '/';
+ perm = 0777;
+ }
if (verbose_) {
printf("%c %o %s\n", isdir ? 'd' : 'f', perm, filename);
}