mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(main): Ignore -f if no file operand is specified
and standard input is a pipe.
This commit is contained in:
1 parent
e5d9694985
commit
255eb9cf44
1 file changed
+9
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user