OSDN Git Service

Fix tzdata loading.
authorElliott Hughes <enh@google.com>
Mon, 3 Oct 2016 19:29:30 +0000 (12:29 -0700)
committerElliott Hughes <enh@google.com>
Mon, 3 Oct 2016 19:45:13 +0000 (12:45 -0700)
commit81c46fc10fa60fd341f11024d8d3f26ff2c69082
tree3d7ab14836caafda998bbd584d1c26c01858276f
parentd6096307991c3bae2b3fcfbab8632e406cc84669
Fix tzdata loading.

Android uses one large file of tzdata, so the "read up to the maximum
possible length of a valid tzfile" code in upstream localtime.c is
broken: there is always data after the current tzfile (even the
last tzfile is followed by the zone.tab data). This patch passes the
exact length through to the read(2) call so we don't over-read, rather
than have to rewrite upstream code that measures back from the "end" of
the tzfile.

The old code failed the existing time.strftime_null_tm_zone test after
updating to tzdata2016g.

Bug: http://b/31848040
Test: time.strftime_null_tm_zone
Change-Id: Iee059b5a8c051bd4952cfd80f02b00d83e489d5e
libc/tzcode/localtime.c