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 23:37:26 +0000 (16:37 -0700)
commitfa8f1d0ab21ae18e34c4d2274872f0f2e19cb479
treeff07a3398d2c6e6273ee05064ce36d856eeb4e32
parentabe80314ebc39dec4c2d6e65fb11c1e16e3cfe09
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.

(cherry picked from commit 81c46fc10fa60fd341f11024d8d3f26ff2c69082)

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