From: Theo Buehler Subject: Re: date & touch: timegm/mktime checks To: Theo de Raadt Cc: tech@openbsd.org Date: Sun, 21 Jun 2026 17:31:52 +0200 On Sun, Jun 21, 2026 at 09:17:16AM -0600, Theo de Raadt wrote: > These look correct. > > But they look like useless chicken scratches, which an uneducated developer > might delete later, don't they? > > We also don't just want to to this in our tree, but for the idiom to be > copied far and wide. > > I think the docs and the landed diffs will fail to educate the outside > community on using this pattern, and the manual page example should be > improved and then idiomatically copied into all the places of use. > > Index: time/ctime.3 > =================================================================== > RCS file: /cvs/src/lib/libc/time/ctime.3,v > diff -u -p -u -r1.55 ctime.3 > --- time/ctime.3 21 Jun 2026 08:16:35 -0000 1.55 > +++ time/ctime.3 21 Jun 2026 15:10:33 -0000 > @@ -406,7 +406,7 @@ did not change from \-1, an error has oc > .Bd -literal -offset indent > struct tm tm; > \&... > -tm.tm_wday = -1; > +tm.tm_wday = -1; /* sentinel for error */ > if (mktime(&tm) == -1 && tm.tm_wday == -1) > goto error; > .Ed > > Which means all the tm.tm_wday = -1; in the tree should get that > comment. Sure, I'm fine with that.