summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-05 12:19:48 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:43:45 +0100
commit7c271fdbba87b4cc782077126c8ac4b0795b6b29 (patch)
tree0e573ae959c72b31d09a6f02045a2b8b34c260b0
parent134903a7c4622a7971e7d4cc7f0fbfc1350beb82 (diff)
downloadsocket_wrapper-7c271fdbba87b4cc782077126c8ac4b0795b6b29.tar.gz
socket_wrapper-7c271fdbba87b4cc782077126c8ac4b0795b6b29.tar.xz
socket_wrapper-7c271fdbba87b4cc782077126c8ac4b0795b6b29.zip
swrap: Use swrap structure for read.
-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 50eb4b9..3779be1 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_read)(int fd, void *buf, size_t count);
-
-static int real_read(int fd, void *buf, size_t count)
-{
- if (libc_read == NULL) {
- *(void **)(&libc_read) = libc_dlsym("read");
- }
-
- return libc_read(fd, buf, count);
-}
-
static ssize_t (*libc_readv)(int fd, const struct iovec *iov, int iovcnt);
static ssize_t real_readv(int fd, const struct iovec *iov, int iovcnt)
@@ -2976,14 +2965,14 @@ static ssize_t swrap_read(int s, void *buf, size_t len)
struct socket_info *si = find_socket_info(s);
if (!si) {
- return real_read(s, buf, len);
+ return swrap.fns.libc_read(s, buf, len);
}
if (si->type == SOCK_STREAM) {
len = MIN(len, SOCKET_MAX_PACKET);
}
- ret = real_read(s, buf, len);
+ ret = swrap.fns.libc_read(s, buf, len);
if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
swrap_dump_packet(si, NULL, SWRAP_RECV_RST, NULL, 0);
} else if (ret == 0) { /* END OF FILE */