mirror of
git://git.sv.gnu.org/coreutils
synced 2026-06-07 08:09:01 -04:00
(main): Ignore -f if no file operand is specified
and standard input is a pipe.
This commit is contained in:
@@ -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