summaryrefslogtreecommitdiff
path: root/src/tee.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2023-02-28 18:36:02 +0000
committerPádraig Brady <P@draigBrady.com>2023-03-01 19:27:36 +0000
commit76b5843ff99977107580cd581213ea2b5b3a81a7 (patch)
tree6a609b39fd0ada8899892e40dbea7befbb2ffd9e /src/tee.c
parent5bcc2912e7d7c16d3052a7ed4f0904f72573255e (diff)
downloadcoreutils-76b5843ff99977107580cd581213ea2b5b3a81a7.tar.gz
maint: refactor tail.c to use iopoll
* src/tail.c (check_output_alive): Reuse iopoll() rather than directly calling poll() or select(). * src/iopoll.c (iopoll): Refactor to support non blocking operation, or ignoring descriptors by passing a negative value. * src/iopoll.h (iopoll): Adjust to support a BLOCK parameter. * src/tee.c (tee_files): Adjust iopoll() call to explicitly block. * src/local.mk: Have tail depend on iopoll.c.
Diffstat (limited to 'src/tee.c')
-rw-r--r--src/tee.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tee.c b/src/tee.c
index e328e6f04..dcf773e16 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -290,7 +290,8 @@ tee_files (int nfiles, char **files)
if (pipe_check && out_pollable[first_out])
{
/* Monitor for input, or errors on first valid output. */
- int err = iopoll (STDIN_FILENO, fileno (descriptors[first_out]));
+ int err = iopoll (STDIN_FILENO, fileno (descriptors[first_out]),
+ true);
/* Close the output if it became a broken pipe. */
if (err == IOPOLL_BROKEN_OUTPUT)