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.
This commit is contained in:
Paul Eggert
2014-11-11 14:53:26 -08:00
parent 0965ee56d1
commit da5a36565c
2 changed files with 18 additions and 2 deletions
+9
View File
@@ -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
+9 -2
View File
@@ -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;
}
}