From 2474f2092fe30282bc4413e4ea29182b9f37c849 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 13 Sep 2024 11:57:41 +0000 Subject: TclFSCwdIsNative may return wrong result when cwd is not initialized in TSD (if pwd/cd never called for this thread) --- generic/tclIOUtil.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index e630702..67ee48b 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -469,6 +469,11 @@ TclFSCwdIsNative(void) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey); + /* if not yet initialized - ensure we'll once obtain cwd */ + if (!tsdPtr->cwdPathEpoch) { + Tcl_FSGetCwd(NULL); + } + if (tsdPtr->cwdClientData != NULL) { return 1; } else { -- cgit v0.12