From 0cd6dfb85f930275d486104b380c60ae13f4ee46 Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Mon, 29 Jun 2015 11:06:50 +0000 Subject: 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 --- third_party/ijar/zip_main.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'third_party') 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); } -- cgit v1.2.3