summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-02-11 11:37:41 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-02-11 11:37:41 +0100
commit98d23418035d822c5c57c337a84ed04662a29120 (patch)
treea401a71cea52e1a90eb882c1d7fad78ddbe450b8
parent44ffb793acac94eb7764b65b9d462b0f6eff1b42 (diff)
downloadsocket_wrapper-98d23418035d822c5c57c337a84ed04662a29120.tar.gz
socket_wrapper-98d23418035d822c5c57c337a84ed04662a29120.tar.xz
socket_wrapper-98d23418035d822c5c57c337a84ed04662a29120.zip
Add read() wrapper.
-rw-r--r--src/socket_wrapper.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index b9461b9..a58d5ef 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -300,6 +300,17 @@ static int real_listen(int sockfd, int backlog)
return libc_listen(sockfd, backlog);
}
+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 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)
@@ -2506,8 +2517,7 @@ ssize_t recv(int s, void *buf, size_t len, int flags)
return ret;
}
-#if 0
-_PUBLIC_ ssize_t swrap_read(int s, void *buf, size_t len)
+ssize_t read(int s, void *buf, size_t len)
{
int ret;
struct socket_info *si = find_socket_info(s);
@@ -2535,7 +2545,7 @@ _PUBLIC_ ssize_t swrap_read(int s, void *buf, size_t len)
return ret;
}
-
+#if 0
_PUBLIC_ ssize_t swrap_send(int s, const void *buf, size_t len, int flags)
{
struct msghdr msg;