From 09d296e1a7159bfb801642baeee81b08e5e4db56 Mon Sep 17 00:00:00 2001
From: Wojciech Kocjan <zoro2@users.sourceforge.net>
Date: Thu, 15 Mar 2012 18:51:50 +0000
Subject: [PATCH] 2012-03-15  Wojciech Kocjan <zoro2@users.sourceforge.net>

	* zipvfs.tcl: Fix for zip symlinks not supported anymore, bug 3505283
---
 ChangeLog          | 4 ++++
 library/zipvfs.tcl | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 243e906..11d4321 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-15  Wojciech Kocjan <zoro2@users.sourceforge.net>
+
+	* zipvfs.tcl: Fix for zip symlinks not supported anymore, bug 3505283
+
 2011-11-28  Steve Huntley  <stephen.huntley@alum.mit.edu>
 
 	* vfslib.tcl: Applied contributed patch for bug 3412801.  Clean up watch
diff --git a/library/zipvfs.tcl b/library/zipvfs.tcl
index 7e55af4..b40803a 100644
--- a/library/zipvfs.tcl
+++ b/library/zipvfs.tcl
@@ -73,9 +73,10 @@ proc vfs::zip::stat {zipfd name} {
     #::vfs::log "stat $name"
     ::zip::stat $zipfd $name sb
     #::vfs::log [array get sb]
-    # remove additional mode bits to prevent Tcl from reporting Fossil archives
-    # as socket types
-    set sb(mode) [expr {$sb(mode) & 0x01ff}]
+    # remove socket mode bit (0xc000) to prevent Tcl from reporting Fossil archives as socket types
+    if {($sb(mode) & 0xc000) == 0xc000} {
+        set sb(mode) [expr {$sb(mode) ^ 0xc000}]
+    }
     array get sb
 }
 
-- 
2.23.0