From b3324ca1965535fb3ab01c110350c6ebdede434a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 10 Nov 2000 18:54:19 +0000 Subject: (main): Interpret a lone numeric argument of 8 or 10 digits as a file name, rather than as a date/time in the obsolescent `MMDDhhmm[YY]' format. Reported by Wenjun Zheng. --- src/touch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/touch.c b/src/touch.c index a10575146..df595ae8e 100644 --- a/src/touch.c +++ b/src/touch.c @@ -334,7 +334,9 @@ main (int argc, char **argv) date_set++; } - if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--")) + /* The obsolescent `MMDDhhmm[YY]' form is valid IFF there are + two or more non-option arguments. */ + if (!date_set && 2 <= argc - optind && !STREQ (argv[optind - 1], "--")) { newtime = posixtime (argv[optind], PDS_TRAILING_YEAR); if (newtime != (time_t) -1) -- cgit v1.2.3-70-g09d2