fd_copy.c (267B)
1 /* ISC license. */ 2 3 #include <unistd.h> 4 #include <errno.h> 5 #include <skalibs/djbunix.h> 6 7 int fd_copy (int to, int from) 8 { 9 int r ; 10 if (to == from) return (errno = EINVAL, -1) ; 11 do 12 r = dup2(from, to) ; 13 while ((r == -1) && (errno == EINTR)) ; 14 return r ; 15 }