dup2
int dup2(int oldfd,newfd);
use
duplicate the file descritpor oldfd
to newfd
return code
return the copy of the file descriptor on sucess or return -1 and set errno on error
EBADF
oldfd
is not open or don’t existEBADF
newfd
is aready open or don’t existEIO
an IO error happend while duplicatingfd