summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-24 13:11:18 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-24 13:11:18 -0400
commit190bbb992344e350925bb9ebc37775ba8cc4c19f (patch)
treead17976511895862fd12a1bb83e3c1a9845247d0 /src
parent32985d4f632f575274bd08fdc55d8d0a7655a8ef (diff)
downloadmusl-190bbb992344e350925bb9ebc37775ba8cc4c19f.tar.gz
properly fill in tzname[] for old (pre-64-bit-format) zoneinfo files
in this case, the first standard-time and first daylight-time rules should be taken as the "default" ones to expose.
Diffstat (limited to 'src')
-rw-r--r--src/time/__tz.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/time/__tz.c b/src/time/__tz.c
index 8a1836e7..81676d3b 100644
--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -190,7 +190,28 @@ static void do_tzset()
for (s = (const char *)zi+map_size-2; *s!='\n'; s--);
s++;
} else {
- s = 0;
+ const unsigned char *p;
+ __tzname[0] = __tzname[1] = 0;
+ __daylight = __timezone = dst_off = 0;
+ for (i=0; i<5; i++) r0[i] = r1[i] = 0;
+ for (p=types; p<abbrevs; p+=6) {
+ if (!p[4] && !__tzname[0]) {
+ __tzname[0] = (char *)abbrevs + p[5];
+ __timezone = -zi_read32(p);
+ }
+ if (p[4] && !__tzname[1]) {
+ __tzname[1] = (char *)abbrevs + p[5];
+ dst_off = -zi_read32(p);
+ __daylight = 1;
+ }
+ }
+ if (!__tzname[0]) __tzname[0] = __tzname[1];
+ if (!__tzname[0]) __tzname[0] = (char *)__gmt;
+ if (!__daylight) {
+ __tzname[1] = __tzname[0];
+ dst_off = __timezone;
+ }
+ return;
}
}