Просмотр исходного кода

Fix signed 32-bit time_t localtime bug on Fiji

* localtime.c (tzloadbody): When on a host with signed 32-bit
time_t, don't skip reading the 64-bit tables, as skipping caused
the code to mishandle Pacific/Fiji in the year 2038.  With the
recent changes for Fiji, there is a transition from +1300 to +1200
at 2018-01-17 03:00 local time.  Since this transition is after
2037, zic omits the explicit transition, which must be calculated
from the POSIX-TZ-style string "FJT-12FJST,M11.1.0,M1.3.0/3" at
the end of the file.  If the code skips reading the 64-bit tables,
it doesn't get to the proper position to see the POSIX-TZ-style
string.
Paul Eggert 10 лет назад
Родитель
Сommit
6d00980f1f
1 измененных файлов с 0 добавлено и 5 удалено
  1. 0 5
      localtime.c

+ 0 - 5
localtime.c

@@ -556,11 +556,6 @@ tzloadbody(char const *name, struct state *sp, bool doextend,
 			break;
 		nread -= p - up->buf;
 		memmove(up->buf, p, nread);
-		/*
-		** If this is a signed narrow time_t system, we're done.
-		*/
-		if (TYPE_SIGNED(time_t) && stored >= (int) sizeof(time_t))
-			break;
 	}
 	if (doextend && nread > 2 &&
 		up->buf[0] == '\n' && up->buf[nread - 1] == '\n' &&