diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-07-22 20:54:04 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-07-22 20:54:04 +0000 |
commit | 255eb9cf44100e5fbd269e7ccf04faafb0c38f73 (patch) | |
tree | eba510711a8b2e4f178e240f4b5bffef1e90b5ad | |
parent | e5d9694985fdc0a3b462ae9ae1f9e85474744210 (diff) | |
download | coreutils-255eb9cf44100e5fbd269e7ccf04faafb0c38f73.tar.xz |
(main): Ignore -f if no file operand is specified
and standard input is a pipe.
-rw-r--r-- | src/tail.c | 9 |
1 files changed, 9 insertions, 0 deletions
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; + } } { |