summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;