summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:46:26 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:46:26 +0100
commit063c81a918b899b35645d238063f9c6a11881a32 (patch)
treee7bba4b65d6561b27221080beef52e8b762e6a44
parentbc81181b2dfea7eb99cec9003f62705f6797d0dc (diff)
downloadsocket_wrapper-063c81a918b899b35645d238063f9c6a11881a32.zip
socket_wrapper-063c81a918b899b35645d238063f9c6a11881a32.tar.gz
socket_wrapper-063c81a918b899b35645d238063f9c6a11881a32.tar.xz
swrap: Use swrap structure for recv.
-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 8ae0efb..bb2f7d3 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -561,17 +561,6 @@ static int libc_vioctl(int d, unsigned long int request, va_list ap)
return rc;
}
-static int (*libc_recv)(int sockfd, void *buf, size_t len, int flags);
-
-static int real_recv(int sockfd, void *buf, size_t len, int flags)
-{
- if (libc_recv == NULL) {
- *(void **)(&libc_recv) = libc_dlsym("recv");
- }
-
- return libc_recv(sockfd, buf, len, flags);
-}
-
static int (*libc_recvfrom)(int sockfd, void *buf, size_t len, int flags,
struct sockaddr *src_addr, socklen_t *addrlen);
@@ -2920,14 +2909,14 @@ static ssize_t swrap_recv(int s, void *buf, size_t len, int flags)
struct socket_info *si = find_socket_info(s);
if (!si) {
- return real_recv(s, buf, len, flags);
+ return swrap.fns.libc_recv(s, buf, len, flags);
}
if (si->type == SOCK_STREAM) {
len = MIN(len, SOCKET_MAX_PACKET);
}
- ret = real_recv(s, buf, len, flags);
+ ret = swrap.fns.libc_recv(s, buf, len, flags);
if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
swrap_dump_packet(si, NULL, SWRAP_RECV_RST, NULL, 0);
} else if (ret == 0) { /* END OF FILE */