diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2025-09-23 12:56:11 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2025-09-23 12:56:11 +0000 |
| commit | a5f14e4f9069a8ffed66d923bb0ecf20d8a0e6af (patch) | |
| tree | b83d927fe269c4c0949432912e976dc3dc87dbbf /contrib/tzcode | |
| parent | 3aac05f56620712744cb57d71a0ef42f8d8e3b52 (diff) | |
Diffstat (limited to 'contrib/tzcode')
| -rw-r--r-- | contrib/tzcode/localtime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index 15afeeecb6d0..7ba72d730648 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -1649,9 +1649,13 @@ tzset_unlocked_name(char const *name) lclptr = sp = malloc(sizeof *lclptr); # endif if (sp) { - if (zoneinit(sp, name, TZLOAD_FROMENV | TZLOAD_TZSTRING) != 0) { + int err = zoneinit(sp, name, TZLOAD_FROMENV | TZLOAD_TZSTRING); + if (err != 0) { zoneinit(sp, "", 0); - strcpy(sp->chars, UNSPEC); + /* Abbreviate with "-00" if there was an error. + Do not treat a missing TZDEFAULT file as an error. */ + if (name || err != ENOENT) + strcpy(sp->chars, UNSPEC); } if (0 < lcl) strcpy(lcl_TZname, name); |
