diff options
author | wollman <wollman@FreeBSD.org> | 1997-01-13 17:12:23 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1997-01-13 17:12:23 +0000 |
commit | ea03e008b1ca935107c0916c2c0b706b049cd639 (patch) | |
tree | 42aa857978b8a45fd0c44f97fb70e29b9bd0131f /lib | |
parent | bea2e1602582a59e8cd603b48f65dfad57474b0a (diff) | |
download | FreeBSD-src-ea03e008b1ca935107c0916c2c0b706b049cd639.zip FreeBSD-src-ea03e008b1ca935107c0916c2c0b706b049cd639.tar.gz |
When attempting to load a `lastditch' timezone (e.g., because the load
of the user's timezone failed), don't bail if the specified timezone
doesn't have an offset; in this case it isn't going to. (Perhaps it would
be better to change the caller to always supply one, but this is quick
and clean and fixes the bug in the easiest possible way.)
Should be in 2.2. Fixes (properly) PR#1740.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdtime/localtime.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 35a7071..5fe9f98 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -724,18 +724,19 @@ const int lastditch; name += stdlen; if (stdlen >= sizeof sp->chars) stdlen = (sizeof sp->chars) - 1; + stdoffset = 0; } else { name = getzname(name); stdlen = name - stdname; if (stdlen < 3) return -1; - } - if (*name == '\0') - return -1; /* was "stdoffset = 0;" */ - else { - name = getoffset(name, &stdoffset); - if (name == NULL) - return -1; + if (*name == '\0') + return -1; /* was "stdoffset = 0;" */ + else { + name = getoffset(name, &stdoffset); + if (name == NULL) + return -1; + } } load_result = tzload(TZDEFRULES, sp); if (load_result != 0) |