diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 12:10:10 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 13:43:45 +0100 |
commit | 2cd71169229374e0b83dbc2a4bcdd2d84a4aad6a (patch) | |
tree | 1e3db541b26af332140255580e01bb2d8c5deed5 | |
parent | 8e1dcb5295bb032ea2774b2d07ba11db4b8854c0 (diff) | |
download | socket_wrapper-2cd71169229374e0b83dbc2a4bcdd2d84a4aad6a.tar.gz socket_wrapper-2cd71169229374e0b83dbc2a4bcdd2d84a4aad6a.tar.xz socket_wrapper-2cd71169229374e0b83dbc2a4bcdd2d84a4aad6a.zip |
swrap: Use swrap structure for dup.
-rw-r--r-- | src/socket_wrapper.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index dd7d355..af93e93 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_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_dup2)(int oldfd, int newfd); static int real_dup2(int oldfd, int newfd) @@ -3421,7 +3410,7 @@ static int swrap_dup(int fd) si = find_socket_info(fd); if (!si) { - return real_dup(fd); + return swrap.fns.libc_dup(fd); } fi = (struct socket_info_fd *)calloc(1, sizeof(struct socket_info_fd)); @@ -3430,7 +3419,7 @@ static int swrap_dup(int fd) return -1; } - fi->fd = real_dup(fd); + fi->fd = swrap.fns.libc_dup(fd); if (fi->fd == -1) { int saved_errno = errno; free(fi); |