Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: date & touch: timegm/mktime checks
To:
Theo de Raadt <deraadt@openbsd.org>
Cc:
tech@openbsd.org
Date:
Mon, 22 Jun 2026 14:22:35 +0200

Download raw body.

Thread
On Sun, Jun 21, 2026 at 09:17:16AM -0600, Theo de Raadt wrote:
> Which means all the tm.tm_wday = -1; in the tree should get that
> comment.
> 

Here's another manpage update:

Index: sys/clock_gettime.2
===================================================================
RCS file: /cvs/src/lib/libc/sys/clock_gettime.2,v
diff -u -p -r1.32 clock_gettime.2
--- sys/clock_gettime.2	31 Mar 2022 17:27:16 -0000	1.32
+++ sys/clock_gettime.2	22 Jun 2026 12:21:20 -0000
@@ -236,10 +236,11 @@ y2k.tm_mday = 1;
 y2k.tm_hour = 0;
 y2k.tm_min = 0;
 y2k.tm_sec = 0;
+y2k.tm_wday = -1;	/* sentinel for error */
 
 ts.tv_nsec = 0;
 ts.tv_sec = timegm(&y2k);
-if (ts.tv_sec == -1)
+if (ts.tv_sec == -1 && y2k.tm_wday == -1)
 	err(1, "timegm");
 
 if (clock_settime(CLOCK_REALTIME, &ts) == -1)