summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-09-08 17:19:51 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-09-08 17:19:51 +0000
commit5c81574ed52d294a58617c9bb8b86fb0caa1f71e (patch)
tree8faccf4d3991af4d9ec5a8f90f9a440e0d4261b5 /src
parentd7619b5fe899074ef196154b2eec54d51290d450 (diff)
downloadcoreutils-5c81574ed52d294a58617c9bb8b86fb0caa1f71e.tar.xz
tail now ignores the -f option if POSIXLY_CORRECT is set,
no file operand is given, and standard input is any FIFO.
Diffstat (limited to 'src')
-rw-r--r--src/tail.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tail.c b/src/tail.c
index 082ddfc52..7d8f421e6 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1640,10 +1640,15 @@ main (int argc, char **argv)
if (forever && getenv ("POSIXLY_CORRECT"))
{
- int is_a_pipe = isapipe (STDIN_FILENO);
- if (is_a_pipe < 0)
+ struct stat st;
+ int is_a_fifo_or_pipe =
+ (fstat (STDIN_FILENO, &st) != 0 ? -1
+ : S_ISFIFO (st.st_mode) ? 1
+ : HAVE_FIFO_PIPES == 1 ? 0
+ : isapipe (STDIN_FILENO));
+ if (is_a_fifo_or_pipe < 0)
error (EXIT_FAILURE, errno, _("standard input"));
- if (is_a_pipe)
+ if (is_a_fifo_or_pipe)
forever = false;
}
}