Преглед изворни кода

fix mishandling of empty or blank TZ environment variable

the empty TZ string was matching equal to the initial value of the
cached TZ name, thus causing do_tzset never to run and never to
initialize the time zone data.
Rich Felker пре 11 година
родитељ
комит
bd5ed22c58
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/time/__tz.c

+ 1 - 1
src/time/__tz.c

@@ -127,7 +127,7 @@ static void do_tzset()
 		"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
 
 	s = getenv("TZ");
-	if (!s) s = "";
+	if (!s || !*s) s = "GMT0";
 
 	if (old_tz && !strcmp(s, old_tz)) return;