From: Wojciech Kocjan <zoro2@users.sourceforge.net>
Date: Mon, 10 Mar 2014 11:40:46 +0000 (+0000)
Subject: Fix for #92 vfs::zip unable to read zip archives with wrong modes
X-Git-Url: http://test.brassandglass.co.uk/gitweb?a=commitdiff_plain;h=c67e9aa29007683ab06ef8d422f508f7770f4014;p=tclvfs

Fix for #92 vfs::zip unable to read zip archives with wrong modes
---

diff --git a/library/zipvfs.tcl b/library/zipvfs.tcl
index 7cb00a6..80900ac 100644
--- a/library/zipvfs.tcl
+++ b/library/zipvfs.tcl
@@ -89,6 +89,11 @@ proc vfs::zip::stat {zipfd name} {
     if {($sb(mode) & 0xf000) == 0x2000} {
         set sb(mode) [expr {$sb(mode) ^ 0x2000}]
     }
+    # workaround for certain errorneus zip archives
+    if {($sb(mode) & 0xffff) == 0xffff} {
+	# change to directory type and set mode to 0777 + directory flag
+	set sb(mode) 0x41ff
+    }
     array get sb
 }