diff options
author | Jim Meyering <jim@meyering.net> | 2000-11-10 18:54:19 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-11-10 18:54:19 +0000 |
commit | b3324ca1965535fb3ab01c110350c6ebdede434a (patch) | |
tree | 90fd576936d3b279602be2fdcbe3c698a4241d95 /src | |
parent | c90aa4af6c0a35797a6b7cadee1c34223120194f (diff) | |
download | coreutils-b3324ca1965535fb3ab01c110350c6ebdede434a.tar.xz |
(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.
Diffstat (limited to 'src')
-rw-r--r-- | src/touch.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) |