Lines Matching refs:newfd
5603 int newfd; in savefd() local
5606 newfd = fcntl(from, F_DUPFD_CLOEXEC, 10); in savefd()
5607 err = newfd < 0 ? errno : 0; in savefd()
5613 close_on_exec_on(newfd); in savefd()
5616 return newfd; in savefd()
5621 int newfd; in dup2_or_raise() local
5623 newfd = (from != to) ? dup2(from, to) : to; in dup2_or_raise()
5624 if (newfd < 0) { in dup2_or_raise()
5628 return newfd; in dup2_or_raise()
5633 int newfd; in dup_CLOEXEC() local
5635 newfd = fcntl(fd, F_DUPFD_CLOEXEC, avoid_fd + 1); in dup_CLOEXEC()
5636 if (newfd >= 0) { in dup_CLOEXEC()
5638 close_on_exec_on(newfd); in dup_CLOEXEC()
5645 return newfd; in dup_CLOEXEC()
5650 int newfd; in xdup_CLOEXEC_and_close() local
5652 newfd = fcntl(fd, F_DUPFD_CLOEXEC, avoid_fd + 1); in xdup_CLOEXEC_and_close()
5653 if (newfd < 0) { in xdup_CLOEXEC_and_close()
5661 ash_msg_and_raise_perror("%d", newfd); in xdup_CLOEXEC_and_close()
5664 close_on_exec_on(newfd); in xdup_CLOEXEC_and_close()
5666 return newfd; in xdup_CLOEXEC_and_close()
5834 int newfd; in redirect() local
5841 newfd = redir->ndup.dupfd; in redirect()
5844 newfd = openredirect(redir); /* always >= 0 */ in redirect()
5845 if (fd == newfd) { in redirect()
5854 close_fd = newfd; in redirect()
5857 if (fd == newfd) in redirect()
5866 closed = save_fd_on_redirect(fd, /*avoid:*/ newfd, sv); in redirect()
5867 if (newfd == -1) { in redirect()
5876 if (internally_opened_fd(newfd, sv)) { in redirect()
5878 ash_msg_and_raise_perror("%d", newfd); in redirect()
5880 dup2_or_raise(newfd, fd); in redirect()
5887 newfd = 1; in redirect()