From: Jim Meyering Date: Fri, 10 Nov 2000 18:54:19 +0000 (+0000) Subject: (main): Interpret a lone numeric argument of 8 or 10 X-Git-Tag: FILEUTILS-4_0_32~17 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=b3324ca1965535fb3ab01c110350c6ebdede434a;p=thirdparty%2Fcoreutils.git (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. --- diff --git a/src/touch.c b/src/touch.c index a105751462..df595ae8ec 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)