mirror of
https://github.com/coreutils/coreutils.git
synced 2025-01-22 08:03:40 +08:00
(main): Ignore -f if no file operand is specified
and standard input is a pipe.
This commit is contained in:
parent
e5d9694985
commit
255eb9cf44
@ -1687,6 +1687,15 @@ main (int argc, char **argv)
|
|||||||
static char *dummy_stdin = "-";
|
static char *dummy_stdin = "-";
|
||||||
n_files = 1;
|
n_files = 1;
|
||||||
file = &dummy_stdin;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user