Date: Tue, 4 Jan 2000 03:00:04 -0800 (PST) From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/15872: Y2k bug in at(1) Message-ID: <200001041100.DAA12892@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/15872; it has been noted by GNATS.
From: Sheldon Hearn <sheldonh@uunet.co.za>
To: cjc@cc942873-a.ewndsr1.nj.home.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/15872: Y2k bug in at(1)
Date: Tue, 04 Jan 2000 12:55:34 +0200
On Mon, 03 Jan 2000 21:54:28 EST, "Crist J. Clark" wrote:
> if (year > 99) {
> if (year > 1899)
> year -= 1900;
> else
> panic("garbled time");
> } ...
What odd code. :-)
I'd fix this by making proper tm_year adjustments before those calls to
assign_date() which pass it a tm_year value.
Have you chatted to the authors? Are they unreachable?
Ciao,
Sheldon.
Index: parsetime.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/at/parsetime.c,v
retrieving revision 1.19
diff -u -d -r1.19 parsetime.c
--- parsetime.c 1999/12/05 19:57:14 1.19
+++ parsetime.c 2000/01/04 10:54:54
@@ -495,7 +495,7 @@
tm->tm_wday = wday;
- assign_date(tm, mday, tm->tm_mon, tm->tm_year);
+ assign_date(tm, mday, tm->tm_mon, 1900 + tm->tm_year);
break;
case NUMBER:
@@ -527,7 +527,7 @@
}
else if (tlen == 6 || tlen == 8) {
if (tlen == 8) {
- year = (mon % 10000) - 1900;
+ year = mon % 10000;
mon /= 10000;
}
else {
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001041100.DAA12892>
