diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-11-11 14:53:26 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-11-11 14:53:26 -0800 |
commit | da5a36565cc62083b50656e86c6f8af42199ad8e (patch) | |
tree | 772c578d3eabaec2d6f33e31018d9754d5ea350e | |
parent | 0965ee56d1e730797d3423e1a12f04881c41f3ca (diff) | |
download | tz-da5a36565cc62083b50656e86c6f8af42199ad8e.tar.gz |
tzalloc should scrub abbreviations, compatibly with tzset.
* localtime.c (settzname): Move scrubbing into ...
(scrub_abbrs): ... this new function.
(zoneinit): Use it here, rather than in settzname.
* NEWS: Document this.
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | localtime.c | 11 |
2 files changed, 18 insertions, 2 deletions
@@ -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; } } |