summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tail.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/tail.c b/src/tail.c
index b158584b5..78b899ee5 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -847,7 +847,6 @@ main (int argc, char **argv)
off_t n_units = -1;
long int tmp_long;
int c; /* Option character. */
- int i;
int n_files;
char **file;
@@ -1006,13 +1005,18 @@ main (int argc, char **argv)
print_headers = 1;
if (n_files == 0)
- exit_status |= tail_file ("-", n_units, 0);
-
- for (i = 0; i < n_files; i++)
- exit_status |= tail_file (file[i], n_units, i);
+ {
+ exit_status |= tail_file ("-", n_units, 0);
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < n_files; i++)
+ exit_status |= tail_file (file[i], n_units, i);
- if (forever_multiple)
- tail_forever (file, n_files);
+ if (forever_multiple)
+ tail_forever (file, n_files);
+ }
if (have_read_stdin && close (0) < 0)
error (EXIT_FAILURE, errno, "-");