summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2014-02-13 23:16:03 +0000
committermillert <millert@openbsd.org>2014-02-13 23:16:03 +0000
commitdddb2a649dc2e9e313fe205b1c353a6d740e5784 (patch)
tree6077d2b57af10188582033d35a254aaad54535bd /lib/libc
parentSome Linux i915 drm "fast" path code relies on being able to "disable" page (diff)
downloadwireguard-openbsd-dddb2a649dc2e9e313fe205b1c353a6d740e5784.tar.xz
wireguard-openbsd-dddb2a649dc2e9e313fe205b1c353a6d740e5784.zip
Fix logic bug; we can only infer tm_yday if both tm_mday and tm_mon
are set. Adapted from a diff from David Higgs. OK krw@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/time/strptime.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c
index 4e7eb4ebf26..8ba53ec4f2b 100644
--- a/lib/libc/time/strptime.c
+++ b/lib/libc/time/strptime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strptime.c,v 1.15 2012/01/16 17:42:45 millert Exp $ */
+/* $OpenBSD: strptime.c,v 1.16 2014/02/13 23:16:03 millert Exp $ */
/* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */
/*-
@@ -594,7 +594,7 @@ literal:
const int year = tm->tm_year + TM_YEAR_BASE;
const int *mon_lens = mon_lengths[isleap(year)];
if (!(fields & FIELD_TM_YDAY) &&
- (fields & (FIELD_TM_MON|FIELD_TM_MDAY))) {
+ (fields & FIELD_TM_MON) && (fields & FIELD_TM_MDAY)) {
tm->tm_yday = tm->tm_mday - 1;
for (i = 0; i < tm->tm_mon; i++)
tm->tm_yday += mon_lens[i];