summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclZipfs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 7b3911c..befcc7d 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -1678,9 +1678,15 @@ ZipFSOpenArchive(
ZIPFS_POSIX_ERROR(interp, "file read error");
goto error;
}
- Tcl_Close(interp, zf->chan);
- zf->chan = NULL;
}
+ /*
+ * Close the Tcl channel. If the file was mapped, the mapping is
+ * unaffected. It is important to close the channel otherwise there is a
+ * potential chicken and egg issue at finalization time as the channels
+ * are closed before the file systems are dismounted.
+ */
+ Tcl_Close(interp, zf->chan);
+ zf->chan = NULL;
return ZipFSFindTOC(interp, needZip, zf);
/*