nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

fd_copy.c (245B)


      1 #include <fcntl.h>
      2 #include <unistd.h>
      3 #include "fd.h"
      4 
      5 int fd_copy(to,from)
      6 int to;
      7 int from;
      8 {
      9   if (to == from) return 0;
     10   if (fcntl(from,F_GETFL,0) == -1) return -1;
     11   close(to);
     12   if (fcntl(from,F_DUPFD,to) == -1) return -1;
     13   return 0;
     14 }