summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changes4
-rw-r--r--generic/tclClock.c9
2 files changed, 8 insertions, 5 deletions
diff --git a/changes b/changes
index d07ac1e..11aa8c5 100644
--- a/changes
+++ b/changes
@@ -7973,4 +7973,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich)
2015-11-20 (bug)[40f628] ListObjReplace callers fail to detect max (porter)
---- Released 8.5.19, December 1, 2015 --- http://core.tcl.tk/tcl/ for details
+2015-12-11 (bug)[c9eb6b] tolerate unset ::env(TZ) (gahr, nijtmans)
+
+--- Released 8.5.19, January 31, 2016 --- http://core.tcl.tk/tcl/ for details
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 3ec94fb..32ba145 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -1994,22 +1994,23 @@ ClockSecondsObjCmd(
static void
TzsetIfNecessary(void)
{
- static char* tzWas = NULL; /* Previous value of TZ, protected by
+ static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by
* clockMutex. */
const char* tzIsNow; /* Current value of TZ */
Tcl_MutexLock(&clockMutex);
tzIsNow = getenv("TZ");
- if (tzIsNow != NULL && (tzWas == NULL || strcmp(tzIsNow, tzWas) != 0)) {
+ if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1)
+ || strcmp(tzIsNow, tzWas) != 0)) {
tzset();
- if (tzWas != NULL) {
+ if (tzWas != NULL && tzWas != INT2PTR(-1)) {
ckfree(tzWas);
}
tzWas = ckalloc(strlen(tzIsNow) + 1);
strcpy(tzWas, tzIsNow);
} else if (tzIsNow == NULL && tzWas != NULL) {
tzset();
- ckfree(tzWas);
+ if (tzWas != INT2PTR(-1)) ckfree(tzWas);
tzWas = NULL;
}
Tcl_MutexUnlock(&clockMutex);