summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c9
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;
+ }
}
{