Why dup()?

Damien Miller djm at mindrot.org
Sat Oct 14 08:14:22 AEDT 2017

On Fri, 13 Oct 2017, David Newall wrote:

> On 13/10/17 16:22, Damien Miller wrote:
>  > At a minimum, I think we'd have to dup2 a fd to /dev/null to
>  > STDOUT_FILENO so writes to stdout (e.g. from ill-behaved
>  > libraries) have somewhere to go.
> Would that really be useful?  Output from Ill-behaved libraries,
> written fd 1, already go to the same place.  Don't forget, dup does
> not create a new file, it creates a duplicate handle to the same
> file.  I'm proposing getting rid of the duplicate.

Then what happens to stdout output between the time that the channel
holding fd 1 closes and the time ssh exits?

More information about the openssh-unix-dev mailing list