diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-05-10 12:49:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-05-10 12:49:17 +0000 |
commit | d58c56ebc7575c57df825ad9b27ddcd86df72da3 (patch) | |
tree | 804e06cc291774f7332d456f0b8c65f9c9534133 | |
parent | b3272abd1b642670f407ec9501df89bb9bc7f6e5 (diff) |
Delete support for military timezones in %z (A-I and K-Y).
They were originally defined in one way, then RFC822 erroneously
redefined them the opposite way, then RFC5322 said they can no
longer be used reliably.
So return NULL like FreeBSD, DragonFly, glibc, and musl do.
Issue reported by Hiltjo Posthuma <hiltjo at codemadness dot org>.
Deletion suggested by tedu@ and deraadt@.
Feedback and OK on the patch from tedu@.
-rw-r--r-- | lib/libc/time/strptime.3 | 14 | ||||
-rw-r--r-- | lib/libc/time/strptime.c | 24 |
2 files changed, 4 insertions, 34 deletions
diff --git a/lib/libc/time/strptime.3 b/lib/libc/time/strptime.3 index ed667de4f96..6f75294370a 100644 --- a/lib/libc/time/strptime.3 +++ b/lib/libc/time/strptime.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: strptime.3,v 1.27 2019/02/21 19:10:32 kn Exp $ +.\" $OpenBSD: strptime.3,v 1.28 2019/05/10 12:49:16 schwarze Exp $ .\" .\" Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -26,7 +26,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: February 21 2019 $ +.Dd $Mdocdate: May 10 2019 $ .Dt STRPTIME 3 .Os .Sh NAME @@ -242,15 +242,7 @@ time or .Ql Standard .Pq Dq S -time; -a single letter military timezone specified as: -.Dq A -through -.Dq I -and -.Dq K -through -.Dq Y . +time. .It Cm \&%Z timezone name or no characters when timezone information is unavailable. .It Cm \&%% diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c index eaf182dc773..d2e24578008 100644 --- a/lib/libc/time/strptime.c +++ b/lib/libc/time/strptime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strptime.c,v 1.25 2019/02/21 19:10:32 kn Exp $ */ +/* $OpenBSD: strptime.c,v 1.26 2019/05/10 12:49:16 schwarze Exp $ */ /* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */ /*- * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. @@ -464,9 +464,6 @@ literal: * C[DS]T = Central : -5 | -6 * M[DS]T = Mountain: -6 | -7 * P[DS]T = Pacific : -7 | -8 - * Military - * [A-IL-M] = -1 ... -9 (J not used) - * [N-Y] = +1 ... +12 */ while (isspace(*bp)) bp++; @@ -520,25 +517,6 @@ literal: bp = ep; continue; } - - if ((*bp >= 'A' && *bp <= 'I') || - (*bp >= 'L' && *bp <= 'Y')) { -#ifdef TM_GMTOFF - /* Argh! No 'J'! */ - if (*bp >= 'A' && *bp <= 'I') - tm->TM_GMTOFF = - ('A' - 1) - (int)*bp; - else if (*bp >= 'L' && *bp <= 'M') - tm->TM_GMTOFF = 'A' - (int)*bp; - else if (*bp >= 'N' && *bp <= 'Y') - tm->TM_GMTOFF = (int)*bp - 'M'; -#endif -#ifdef TM_ZONE - tm->TM_ZONE = NULL; /* XXX */ -#endif - bp++; - continue; - } return NULL; } offs = 0; |