summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-05 12:11:01 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:43:45 +0100
commit9a391bab56829a6881b48de96a86b7cba1668d45 (patch)
tree1d0aee846577f7f6534cec21bba55795de318bb5
parent2cd71169229374e0b83dbc2a4bcdd2d84a4aad6a (diff)
downloadsocket_wrapper-9a391bab56829a6881b48de96a86b7cba1668d45.tar.gz
socket_wrapper-9a391bab56829a6881b48de96a86b7cba1668d45.tar.xz
socket_wrapper-9a391bab56829a6881b48de96a86b7cba1668d45.zip
swrap: Use swrap structure for dup2.
-rw-r--r--src/socket_wrapper.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index af93e93..ef32cbe 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -541,17 +541,6 @@ static void *libc_dlsym(const char *name)
return func;
}
-static int (*libc_dup2)(int oldfd, int newfd);
-
-static int real_dup2(int oldfd, int newfd)
-{
- if (libc_dup2 == NULL) {
- *(void **)(&libc_dup2) = libc_dlsym("dup2");
- }
-
- return libc_dup2(oldfd, newfd);
-}
-
static int (*libc_getpeername)(int sockfd,
struct sockaddr *addr,
socklen_t *addrlen);
@@ -3448,7 +3437,7 @@ static int swrap_dup2(int fd, int newfd)
si = find_socket_info(fd);
if (!si) {
- return real_dup2(fd, newfd);
+ return swrap.fns.libc_dup2(fd, newfd);
}
if (find_socket_info(newfd)) {
@@ -3463,7 +3452,7 @@ static int swrap_dup2(int fd, int newfd)
return -1;
}
- fi->fd = real_dup2(fd, newfd);
+ fi->fd = swrap.fns.libc_dup2(fd, newfd);
if (fi->fd == -1) {
int saved_errno = errno;
free(fi);