summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 303069f..9f31f20 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -234,6 +234,17 @@ static int real_connect(int sockfd,
return libc_connect(sockfd, addr, addrlen);
}
+static int (*libc_dup)(int fd);
+
+static int real_dup(int fd)
+{
+ if (libc_dup == NULL) {
+ *(void **)(&libc_dup) = libc_dlsym("dup");
+ }
+
+ return libc_dup(fd);
+}
+
static int (*libc_getpeername)(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
@@ -2888,8 +2899,7 @@ int close(int fd)
return ret;
}
-#if 0
-_PUBLIC_ int swrap_dup(int fd)
+int dup(int fd)
{
struct socket_info *si;
struct socket_info_fd *fi;
@@ -2918,6 +2928,7 @@ _PUBLIC_ int swrap_dup(int fd)
return fi->fd;
}
+#if 0
_PUBLIC_ int swrap_dup2(int fd, int newfd)
{
struct socket_info *si;