my_dup2 without fcntl
Add the code of my_dup2 without fcntl