* time/tzset.c (__tzset_parse_tz): Reset to named UTC, not unnamed.
(tzset_internal): Rely on __tzset_parse_tz to reset state.
---
time/tzset.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
@@ -352,11 +352,11 @@ parse_rule (const char **tzp, int whichrule)
void
__tzset_parse_tz (const char *tz)
{
- /* Clear out old state and reset to unnamed UTC. */
+ /* Clear out old state and reset to UTC. */
memset (tz_rules, '\0', sizeof tz_rules);
if (NO_DST != 0)
tz_rules[0].type = tz_rules[1].type = NO_DST;
- tz_rules[0].name = tz_rules[1].name = "";
+ tz_rules[0].name = tz_rules[1].name = "UTC";
/* Get the standard time zone abbreviations. */
if (parse_tzname (&tz, 0) && parse_offset (&tz, 0))
@@ -410,9 +410,6 @@ tzset_internal (int always)
/* No change, simply return. */
return;
- tz_rules[0].name = NULL;
- tz_rules[1].name = NULL;
-
/* Save the value of `tz'. */
free (old_tz);
old_tz = __strdup (tz);
@@ -422,18 +419,10 @@ tzset_internal (int always)
if (__use_tzfile)
return;
- /* No data file found. Default to UTC if nothing specified or if
+ /* No data file found. Default to UTC without leap seconds if
TZDEFAULT is broken. */
-
- if (*tz == '\0' || strcmp (tz, TZDEFAULT) == 0)
- {
- memset (tz_rules, '\0', sizeof tz_rules);
- tz_rules[0].name = tz_rules[1].name = "UTC";
- if (NO_DST != 0)
- tz_rules[0].type = tz_rules[1].type = NO_DST;
- update_vars ();
- return;
- }
+ if (strcmp (tz, TZDEFAULT) == 0)
+ tz = "";
__tzset_parse_tz (tz);
}