Why dup()?

David Newall openssh at davidnewall.com
Fri Oct 13 18:50:58 AEDT 2017


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.


More information about the openssh-unix-dev mailing list