Fix Process::BindFd when passing the same fd to the child.
Process::BindFd() allows to map a file descriptor in the parent to a
file descriptor in the child. This was normally used to redirect the
child's stdout or stderr to a given file descriptor in the parent, like
an open file or a pipe. This didn't work when binding a file descriptor
in the parent to the same number in the child, used for example to make
available to the child a file descriptor opened in the parent, but
close all the other file descriptors with SetCloseUnusedFileDescriptors.
TEST=Added unittests for that case.
2 files changed