]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Ignore -f if no file operand is specified
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Jul 2004 20:54:04 +0000 (20:54 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Jul 2004 20:54:04 +0000 (20:54 +0000)
and standard input is a pipe.

src/tail.c

index b6bd04ae162b93979e854831c3720a5889f8dd9a..5e7d9b36982723d9ab30e13c02517d8138f723cd 100644 (file)
@@ -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;
+       }
     }
 
   {