I have a question regarding file descriptors in Unix and C programming.
Let's say I use pipe(fd)
to get file descriptor 3 and 4 for the pipe ends, 3 connects to the read end and 4 to the write end.
Now I use dup2(fd[write_end],1)
to copy the descriptor of the write end (which was 4) to file descriptor 1 in my process. If I now do close(fd[write_end])
will it close descriptor 1 or descriptor 4?