summaryrefslogtreecommitdiff
path: root/ucspi-tcp-0.88/fd_copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'ucspi-tcp-0.88/fd_copy.c')
-rw-r--r--ucspi-tcp-0.88/fd_copy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ucspi-tcp-0.88/fd_copy.c b/ucspi-tcp-0.88/fd_copy.c
new file mode 100644
index 0000000..aa5e55e
--- /dev/null
+++ b/ucspi-tcp-0.88/fd_copy.c
@@ -0,0 +1,11 @@
+#include <fcntl.h>
+#include "fd.h"
+
+int fd_copy(int to,int from)
+{
+ if (to == from) return 0;
+ if (fcntl(from,F_GETFL,0) == -1) return -1;
+ close(to);
+ if (fcntl(from,F_DUPFD,to) == -1) return -1;
+ return 0;
+}