summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-10 07:43:43 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-10 07:54:15 +0100
commitfb02405c73358d36e2cd08bd8d170bf2bbdb5b54 (patch)
tree9e9c57d787175b538393ae820277ade94553cc73
parentc7b7039a4643a975697615d263c1e30e126b9c37 (diff)
downloadsocket_wrapper-fb02405c73358d36e2cd08bd8d170bf2bbdb5b54.zip
socket_wrapper-fb02405c73358d36e2cd08bd8d170bf2bbdb5b54.tar.gz
socket_wrapper-fb02405c73358d36e2cd08bd8d170bf2bbdb5b54.tar.xz
swrap: Add libc_recv().
-rw-r--r--src/socket_wrapper.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 6246925..4c308dd 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -702,6 +702,13 @@ static ssize_t libc_readv(int fd, const struct iovec *iov, int iovcnt)
return swrap.fns.libc_readv(fd, iov, iovcnt);
}
+static int libc_recv(int sockfd, void *buf, size_t len, int flags)
+{
+ swrap_load_lib_function(SWRAP_LIBSOCKET, recv);
+
+ return swrap.fns.libc_recv(sockfd, buf, len, flags);
+}
+
static int libc_recvfrom(int sockfd,
void *buf,
size_t len,
@@ -2999,14 +3006,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 swrap.fns.libc_recv(s, buf, len, flags);
+ return libc_recv(s, buf, len, flags);
}
if (si->type == SOCK_STREAM) {
len = MIN(len, SOCKET_MAX_PACKET);
}
- ret = swrap.fns.libc_recv(s, buf, len, flags);
+ ret = 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 */