Преглед на файлове

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.
Rich Felker преди 11 години
родител
ревизия
32985d4f63
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      src/time/__tz.c

+ 2 - 2
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;