summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-09 19:16:43 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-09 19:29:34 +0100
commitf7d9020866f64b266faf519d5175b01a6e178a50 (patch)
treed0cfdbc3aa5d25d6e1de4243e86afad06b97ba51
parent5f0fa21e38ebefd884958365c3cdb1f3aeeb6149 (diff)
downloadsocket_wrapper-f7d9020866f64b266faf519d5175b01a6e178a50.zip
socket_wrapper-f7d9020866f64b266faf519d5175b01a6e178a50.tar.gz
socket_wrapper-f7d9020866f64b266faf519d5175b01a6e178a50.tar.xz
swrap: Add libc_bind().
-rw-r--r--src/socket_wrapper.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 7736eab..81f77e5 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -591,6 +591,15 @@ static int libc_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
return swrap.fns.libc_accept(sockfd, addr, addrlen);
}
+static int libc_bind(int sockfd,
+ const struct sockaddr *addr,
+ socklen_t addrlen)
+{
+ swrap_load_lib_function(SWRAP_LIBSOCKET, bind);
+
+ return swrap.fns.libc_bind(sockfd, addr, addrlen);
+}
+
static int libc_vioctl(int d, unsigned long int request, va_list ap)
{
long int args[4];
@@ -2190,7 +2199,7 @@ static int swrap_auto_bind(int fd, struct socket_info *si, int family)
type, socket_wrapper_default_iface(), port);
if (stat(un_addr.sun_path, &st) == 0) continue;
- ret = swrap.fns.libc_bind(fd, (struct sockaddr *)(void *)&un_addr,
+ ret = libc_bind(fd, (struct sockaddr *)(void *)&un_addr,
sizeof(un_addr));
if (ret == -1) return ret;
@@ -2302,7 +2311,7 @@ static int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen)
struct socket_info *si = find_socket_info(s);
if (!si) {
- return swrap.fns.libc_bind(s, myaddr, addrlen);
+ return libc_bind(s, myaddr, addrlen);
}
si->myname_len = addrlen;
@@ -2313,7 +2322,7 @@ static int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen)
unlink(un_addr.sun_path);
- ret = swrap.fns.libc_bind(s, (struct sockaddr *)(void *)&un_addr,
+ ret = libc_bind(s, (struct sockaddr *)(void *)&un_addr,
sizeof(struct sockaddr_un));
SWRAP_LOG(SWRAP_LOG_TRACE,