diff options
| author | Andreas Schneider <asn@cryptomilk.org> | 2013-02-11 11:42:31 +0100 |
|---|---|---|
| committer | Andreas Schneider <asn@cryptomilk.org> | 2013-02-11 11:42:31 +0100 |
| commit | b86d2e842e6ff72f847722ae422ec1336b536e6e (patch) | |
| tree | 56497a71c52cc7e9fe4c315e3a7e83b1c25ba621 /src | |
| parent | 98d23418035d822c5c57c337a84ed04662a29120 (diff) | |
| download | socket_wrapper-b86d2e842e6ff72f847722ae422ec1336b536e6e.tar.gz socket_wrapper-b86d2e842e6ff72f847722ae422ec1336b536e6e.tar.xz socket_wrapper-b86d2e842e6ff72f847722ae422ec1336b536e6e.zip | |
Add send() wrapper.
Diffstat (limited to 'src')
| -rw-r--r-- | src/socket_wrapper.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index a58d5ef..869128a 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -335,6 +335,17 @@ static int real_recvfrom(int sockfd, void *buf, size_t len, int flags, return libc_recvfrom(sockfd, buf, len, flags, src_addr, addrlen); } +static int (*libc_send)(int sockfd, const void *buf, size_t len, int flags); + +static int real_send(int sockfd, const void *buf, size_t len, int flags) +{ + if (libc_send == NULL) { + *(void **)(&libc_send) = libc_dlsym("send"); + } + + return libc_send(sockfd, buf, len, flags); +} + static int (*libc_sendto)(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dst_addr, socklen_t addrlen); @@ -2545,8 +2556,7 @@ ssize_t 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) +ssize_t send(int s, const void *buf, size_t len, int flags) { struct msghdr msg; struct iovec tmp; @@ -2585,6 +2595,7 @@ _PUBLIC_ ssize_t swrap_send(int s, const void *buf, size_t len, int flags) return ret; } +#if 0 _PUBLIC_ ssize_t swrap_sendmsg(int s, const struct msghdr *omsg, int flags) { struct msghdr msg; |
