Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/usr.bin/tar Fix Y2K bug in date parser reported by Trevi...
details: https://anonhg.NetBSD.org/src/rev/5129be99fb10
branches: trunk
changeset: 480167:5129be99fb10
user: tron <tron%NetBSD.org@localhost>
date: Wed Jan 05 21:34:11 2000 +0000
description:
Fix Y2K bug in date parser reported by Trevin Beattie in PR y2k/9123.
diffstat:
gnu/usr.bin/tar/getdate.y | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r a31206914680 -r 5129be99fb10 gnu/usr.bin/tar/getdate.y
--- a/gnu/usr.bin/tar/getdate.y Wed Jan 05 19:50:05 2000 +0000
+++ b/gnu/usr.bin/tar/getdate.y Wed Jan 05 21:34:11 2000 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: getdate.y,v 1.4 1998/01/05 04:54:16 perry Exp $
+/* $NetBSD: getdate.y,v 1.5 2000/01/05 21:34:11 tron Exp $
**
** Originally written by Steven M. Bellovin <smb%research.att.com@localhost> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
@@ -98,7 +98,7 @@
#if !defined(lint) && !defined(SABER)
static char RCS[] =
- "$NetBSD: getdate.y,v 1.4 1998/01/05 04:54:16 perry Exp $";
+ "$NetBSD: getdate.y,v 1.5 2000/01/05 21:34:11 tron Exp $";
#endif /* !defined(lint) && !defined(SABER) */
@@ -612,11 +612,14 @@
if (Year < 0)
Year = -Year;
- if (Year < 100)
+ if (Year < 100) {
Year += 1900;
+ if (Year < EPOCH)
+ Year += 100;
+ }
DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
? 29 : 28;
- if (Year < EPOCH || Year > 1999
+ if (Year < EPOCH || Year > 9999
|| Month < 1 || Month > 12
/* Lint fluff: "conversion from long may lose accuracy" */
|| Day < 1 || Day > DaysInMonth[(int)--Month])
Home |
Main Index |
Thread Index |
Old Index