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
