From c67e9aa29007683ab06ef8d422f508f7770f4014 Mon Sep 17 00:00:00 2001
From: Wojciech Kocjan <zoro2@users.sourceforge.net>
Date: Mon, 10 Mar 2014 11:40:46 +0000
Subject: [PATCH] Fix for #92 vfs::zip unable to read zip archives with wrong
 modes

---
 library/zipvfs.tcl | 5 +++++
 1 file changed, 5 insertions(+)

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
 }
 
-- 
2.23.0