summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-05-10 13:30:26 +0000
committerJim Meyering <jim@meyering.net>2003-05-10 13:30:26 +0000
commit09196004812cdc0ac6aa2329e314a7e7bf6d6256 (patch)
treedb99ff141cd8f9d7a2b16a2d7a06343c1cff2562 /src/tail.c
parent3de521ebf928574ee11e96cf1b9e57d31727c871 (diff)
downloadcoreutils-09196004812cdc0ac6aa2329e314a7e7bf6d6256.tar.xz
(main): Test for the case of no arguments before computing n_files.
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tail.c b/src/tail.c
index e69470c24..c91b8d83f 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1624,10 +1624,13 @@ main (int argc, char **argv)
--n_units;
}
- n_files = argc - optind;
- file = argv + optind;
- if (n_files == 0)
+ if (optind < argc)
+ {
+ n_files = argc - optind;
+ file = argv + optind;
+ }
+ else
{
static char *dummy_stdin = "-";
n_files = 1;