When duplicating a file descriptor fd calling dup, and closing the original file descriptors.
Do all the duplicated file descriptors get closed also?
No the duplicates won't be closed. Otherwise the main use-case (duplicating into STDOUT_FILENO
and STDIN_FILENO
) would be pretty useless.