summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEnv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index e4246a1..2788c7e 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -420,6 +420,16 @@ Tcl_PutEnv(
if ((value != NULL) && (value != name)) {
value[0] = '\0';
+#if defined(_WIN32)
+ if (tenviron == NULL) {
+ /*
+ * When we are started from main(), the _wenviron array could
+ * be NULL and will be initialized by the first _wgetenv() call.
+ */
+
+ (void) _wgetenv(L"WINDIR");
+ }
+#endif
TclSetEnv(name, value+1);
}
TclEnvEpoch++;