From: Paul Eggert Date: Thu, 22 Jul 2004 20:54:04 +0000 (+0000) Subject: (main): Ignore -f if no file operand is specified X-Git-Tag: v5.3.0~1113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=255eb9cf44100e5fbd269e7ccf04faafb0c38f73;p=thirdparty%2Fcoreutils.git (main): Ignore -f if no file operand is specified and standard input is a pipe. --- diff --git a/src/tail.c b/src/tail.c index b6bd04ae16..5e7d9b3698 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; + } } {