summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:47:47 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:47:47 +0100
commit9edc0af55a62b06e3dd41d2ad388064b2c1a3a79 (patch)
tree86ab04692227bd8eeeb1dd4b659e3926c8c0da78
parent063c81a918b899b35645d238063f9c6a11881a32 (diff)
downloadsocket_wrapper-9edc0af55a62b06e3dd41d2ad388064b2c1a3a79.zip
socket_wrapper-9edc0af55a62b06e3dd41d2ad388064b2c1a3a79.tar.gz
socket_wrapper-9edc0af55a62b06e3dd41d2ad388064b2c1a3a79.tar.xz
swrap: Use swrap structure for recvfrom.
-rw-r--r--src/socket_wrapper.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index bb2f7d3..cb2daee 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -561,19 +561,6 @@ static int libc_vioctl(int d, unsigned long int request, va_list ap)
return rc;
}
-static int (*libc_recvfrom)(int sockfd, void *buf, size_t len, int flags,
- struct sockaddr *src_addr, socklen_t *addrlen);
-
-static int real_recvfrom(int sockfd, void *buf, size_t len, int flags,
- struct sockaddr *src_addr, socklen_t *addrlen)
-{
- if (libc_recvfrom == NULL) {
- *(void **)(&libc_recvfrom) = libc_dlsym("recvfrom");
- }
-
- 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)
@@ -2782,7 +2769,12 @@ static ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags,
socklen_t ss_len = sizeof(ss);
if (!si) {
- return real_recvfrom(s, buf, len, flags, from, fromlen);
+ return swrap.fns.libc_recvfrom(s,
+ buf,
+ len,
+ flags,
+ from,
+ fromlen);
}
if (!from) {
@@ -2796,8 +2788,12 @@ static ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags,
/* irix 6.4 forgets to null terminate the sun_path string :-( */
memset(&un_addr, 0, sizeof(un_addr));
- ret = real_recvfrom(s, buf, len, flags,
- (struct sockaddr *)(void *)&un_addr, &un_addrlen);
+ ret = swrap.fns.libc_recvfrom(s,
+ buf,
+ len,
+ flags,
+ (struct sockaddr *)(void *)&un_addr,
+ &un_addrlen);
if (ret == -1)
return ret;