
* localtime.c (settzname): Move scrubbing into ... (scrub_abbrs): ... this new function. (zoneinit): Use it here, rather than in settzname. * NEWS: Document this. --- NEWS | 9 +++++++++ localtime.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 98b6e8c..a2ef695 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,14 @@ News for the tz database +Unreleased, experimental changes + + Changes affecting code + + tzalloc now scrubs time zone abbreviations compatibly with the way + that tzset always has, by replacing invalid bytes with '_' and by + shortening too-long abbreviations. + + Release 2014j - 2014-11-10 17:37:11 -0800 Changes affecting current and future time stamps diff --git a/localtime.c b/localtime.c index 5551707..f44390a 100644 --- a/localtime.c +++ b/localtime.c @@ -284,8 +284,13 @@ settzname(void) daylight = 1; #endif /* defined USG_COMPAT */ } +} + +static void +scrub_abbrs(struct state *sp) +{ + int i; /* - ** Finally, scrub the abbreviations. ** First, replace bogus characters. */ for (i = 0; i < sp->charcnt; ++i) @@ -1209,7 +1214,9 @@ zoneinit(struct state *sp, char const *name) } else { int err = tzload(name, sp, true); if (err != 0 && name && name[0] != ':' && tzparse(name, sp, false)) - return 0; + err = 0; + if (err == 0) + scrub_abbrs(sp); return err; } } -- 2.1.0