int dup2(int oldfd, int newfd) { if (smbw_fd(newfd)) { close(newfd); } if (smbw_fd(oldfd)) { return smbw_dup2(oldfd, newfd); } return real_dup2(oldfd, newfd); }
int dup2(int oldfd, int newfd) { check_init("dup2"); if (smbw_fd(newfd)) { (* smbw_libc.close)(newfd); } if (smbw_fd(oldfd)) { return smbw_dup2(oldfd, newfd); } return (* smbw_libc.dup2)(oldfd, newfd); }