Re: date & touch: timegm/mktime checks

Theo Buehler <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.