aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-07-06 22:13:11 +0000
committerRich Felker <dalias@aerifal.cx>2015-07-06 22:13:11 +0000
commit2a780aa3050b86d888489361f04220bfb58890a1 (patch)
tree44106ec5c29eb2c7e5d38a15614534cacb048c31
parentdynlink.c: pass gnu-hash table pointer to gnu_lookup (diff)
downloadgrovel-2a780aa3050b86d888489361f04220bfb58890a1.tar.gz
grovel-2a780aa3050b86d888489361f04220bfb58890a1.tar.xz
treat empty TZ environment variable as GMT rather than default
this improves compatibility with the behavior of other systems and with some applications which set an empty TZ var to disable use of local time by mktime, etc.
-rw-r--r--src/time/__tz.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/time/__tz.c b/src/time/__tz.c
index 13cb1aed..102c8bc7 100644
--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -125,7 +125,8 @@ static void do_tzset()
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
s = getenv("TZ");
- if (!s || !*s) s = "/etc/localtime";
+ if (!s) s = "/etc/localtime";
+ if (!*s) s = __gmt;
if (old_tz && !strcmp(s, old_tz)) return;