From 84e6729c4946b7b154e90ea347fcdc5aa42dc4ee Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 9 Dec 2013 19:24:30 +0100 Subject: swrap: Add libc_dup(). --- src/socket_wrapper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index d983a49..b7488a1 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -616,6 +616,13 @@ static int libc_connect(int sockfd, return swrap.fns.libc_connect(sockfd, addr, addrlen); } +static int libc_dup(int fd) +{ + swrap_load_lib_function(SWRAP_LIBC, dup); + + return swrap.fns.libc_dup(fd); +} + static int libc_vioctl(int d, unsigned long int request, va_list ap) { long int args[4]; @@ -3327,7 +3334,7 @@ static int swrap_dup(int fd) si = find_socket_info(fd); if (!si) { - return swrap.fns.libc_dup(fd); + return libc_dup(fd); } fi = (struct socket_info_fd *)calloc(1, sizeof(struct socket_info_fd)); @@ -3336,7 +3343,7 @@ static int swrap_dup(int fd) return -1; } - fi->fd = swrap.fns.libc_dup(fd); + fi->fd = libc_dup(fd); if (fi->fd == -1) { int saved_errno = errno; free(fi); -- cgit