summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-24 13:10:01 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-24 13:10:01 -0400
commit32985d4f632f575274bd08fdc55d8d0a7655a8ef (patch)
treebd4a7362abd3369b51859e48a5dac65e96b8f449
parentd78be392e144c338f58ce6a51d82c859126c137d (diff)
downloadmusl-32985d4f632f575274bd08fdc55d8d0a7655a8ef.tar.gz
minor fix to tz name checking
if a zoneinfo file is not (or is no longer) in use, don't check the abbrevs pointers, which may be invalid.
-rw-r--r--src/time/__tz.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/time/__tz.c b/src/time/__tz.c
index dfeac519..8a1836e7 100644
--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -395,8 +395,8 @@ const char *__tm_to_tzname(const struct tm *tm)
const void *p = tm->__tm_zone;
LOCK(lock);
do_tzset();
- if (p != __gmt && p != __tzname[0] && p != __tzname[1]
- && (uintptr_t)p-(uintptr_t)abbrevs >= abbrevs_end - abbrevs)
+ if (p != __gmt && p != __tzname[0] && p != __tzname[1] &&
+ (!zi || (uintptr_t)p-(uintptr_t)abbrevs >= abbrevs_end - abbrevs))
p = "";
UNLOCK(lock);
return p;