Lines Matching defs:fd2
9 * Check to see if fd2 is already open; if so, close it.
10 * Duplicate fd1 onto fd2; checking to make sure fd2 is a valid fd.
11 * Return fd2 if all went well; return BADEXIT otherwise.
21 dup2(int fd1, int fd2)
23 if (fd1 != fd2) {
27 if (fcntl(fd2, F_GETFL) >= 0)
28 close(fd2);
29 if (fcntl(fd1, F_DUPFD, fd2) < 0)
36 return fd2;