From 255eb9cf44100e5fbd269e7ccf04faafb0c38f73 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 22 Jul 2004 20:54:04 +0000 Subject: (main): Ignore -f if no file operand is specified and standard input is a pipe. --- src/tail.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tail.c b/src/tail.c index b6bd04ae1..5e7d9b369 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1687,6 +1687,15 @@ main (int argc, char **argv) static char *dummy_stdin = "-"; n_files = 1; file = &dummy_stdin; + + /* POSIX says that -f is ignored if no file operand is specified + and standard input is a pipe. */ + if (forever) + { + struct stat stats; + if (fstat (STDIN_FILENO, &stats) == 0 && S_ISFIFO (stats.st_mode)) + forever = false; + } } { -- cgit v1.2.3-70-g09d2