bug#81060: tee: version 9.11: regression

Bernhard Voelker <[email protected]> Sun, 17 May 2026 12:29:27 +0200
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
On 5/17/26 03:59, Collin Funk wrote:
> This patch fixes it for me:
>=20
> diff --git a/src/iopoll.c b/src/iopoll.c
> index de20bc8d9..a48a12e12 100644
> --- a/src/iopoll.c
> +++ b/src/iopoll.c
> @@ -194,17 +194,6 @@ wait_for_nonblocking_write (int fd)
>     return true;
>   }
>  =20
> -/* wrapper for close() that also waits for FD if non blocking.  */
> -
> -extern bool
> -close_wait (int fd)
> -{
> -  while (wait_for_nonblocking_write (fd))
> -    ;
> -  return close (fd) =3D=3D 0;
> -}
> -
> -
>   /* wrapper for write() that also waits for FD if non blocking.  */
>  =20
>   extern bool
> diff --git a/src/iopoll.h b/src/iopoll.h
> index 1711fdab9..a1561b9ff 100644
> --- a/src/iopoll.h
> +++ b/src/iopoll.h
> @@ -5,5 +5,4 @@ int iopoll (int fdin, int fdout, bool block);
>   bool iopoll_input_ok (int fdin);
>   bool iopoll_output_ok (int fdout);
>  =20
> -bool close_wait (int fd);
>   bool write_wait (int fd, void const *buffer, size_t size);
> diff --git a/src/tee.c b/src/tee.c
> index 32a18e340..fba6ae089 100644
> --- a/src/tee.c
> +++ b/src/tee.c
> @@ -329,7 +329,7 @@ tee_files (int nfiles, char **files, bool pipe_check=
)
>  =20
>     /* Close the files, but not standard output.  */
>     for (int i =3D 1; i <=3D nfiles; i++)
> -    if (0 <=3D descriptors[i] && ! close_wait (descriptors[i]))
> +    if (0 <=3D descriptors[i] && close (descriptors[i]) < 0)
>         {
>           error (0, errno, "%s", quotef (files[i]));
>           ok =3D false;

Great, thanks.  Yes, that fixes the infloop issue for me as well.

Have a nice day,
Berny