summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclEnv.c')
-rw-r--r--generic/tclEnv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 64d0309..1378708 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++;