[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tee: recover from EAGAIN returned from fwrite()
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] tee: recover from EAGAIN returned from fwrite() |
Date: |
Thu, 6 Sep 2018 20:21:04 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 06/09/18 07:28, Kamil Dudka wrote:
> tee expects the output descriptors to operate in blocking mode but this
> assumption might be invalidated by other programs connected to the same
> terminal, as in the following example:
>
> $ telnet ... | tee log_file
>
> telnet calls ioctl(stdin, FIONBIO, [1]), which causes the O_NONBLOCK
> flag to be set on tee's output, which is connected to the same terminal.
>
> This patch has zero impact unless EAGAIN returns from fwrite(). In that
> case we try to reset the O_NONBLOCK flag on the output file descriptor
> and retry the call to fwrite().
Not sure about this.
Would that not be changing the tty to blocking, which is not what telnet wants?
Also this would be a general issue. Why treat tee specially here?
Also would `cat | telnet ... | tee blah` be a workaround?
thanks for the patch,
Pádraig