aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/touch
diff options
context:
space:
mode:
authorDaniel O'Callaghan <danny@FreeBSD.org>1999-01-05 09:58:02 +0000
committerDaniel O'Callaghan <danny@FreeBSD.org>1999-01-05 09:58:02 +0000
commit34c7ff495d35ab4c67c6bb4eefa571e9ad02548e (patch)
tree6e7e8fae838914317a6cc718e4725b2ad50d9710 /usr.bin/touch
parent3523e1b5a7dfd249beca09a02aa7f1af7689589e (diff)
downloadsrc-34c7ff495d35ab4c67c6bb4eefa571e9ad02548e.tar.gz
src-34c7ff495d35ab4c67c6bb4eefa571e9ad02548e.zip
PR: 9323
Submitted by: ishisone@sra.co.jp Make touch handle years 2000-2038 in the obsoleted format, rather than 1902-1969 as was previously the case with two digit year spec.
Notes
Notes: svn path=/head/; revision=42307
Diffstat (limited to 'usr.bin/touch')
-rw-r--r--usr.bin/touch/touch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
index 712d72ecbe6f..81e596a9b4d0 100644
--- a/usr.bin/touch/touch.c
+++ b/usr.bin/touch/touch.c
@@ -260,8 +260,11 @@ stime_arg2(arg, year, tvp)
t->tm_mday = ATOI2(arg);
t->tm_hour = ATOI2(arg);
t->tm_min = ATOI2(arg);
- if (year)
+ if (year) {
t->tm_year = ATOI2(arg);
+ if (t->tm_year < 38) /* support 2000-2038 not 1902-1969 */
+ t->tm_year += 100;
+ }
t->tm_isdst = -1; /* Figure out DST. */
tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);