summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-09 19:33:45 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-09 19:33:45 +0100
commit9dd5276ce25f10278aca8342adfc5bcf332cbeb7 (patch)
treec369d356cc846fe2af306355db534745150cedef
parent3c67ca0e9eedd2db2d5b6c052935fbe43d140703 (diff)
downloadsocket_wrapper-9dd5276ce25f10278aca8342adfc5bcf332cbeb7.zip
socket_wrapper-9dd5276ce25f10278aca8342adfc5bcf332cbeb7.tar.gz
socket_wrapper-9dd5276ce25f10278aca8342adfc5bcf332cbeb7.tar.xz
swrap: Add libc_getsockname().
-rw-r--r--src/socket_wrapper.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 05c934a..ca07550 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -639,6 +639,15 @@ static int libc_getpeername(int sockfd,
return swrap.fns.libc_getpeername(sockfd, addr, addrlen);
}
+static int libc_getsockname(int sockfd,
+ struct sockaddr *addr,
+ socklen_t *addrlen)
+{
+ swrap_load_lib_function(SWRAP_LIBSOCKET, getsockname);
+
+ return swrap.fns.libc_getsockname(sockfd, addr, addrlen);
+}
+
static int libc_vioctl(int d, unsigned long int request, va_list ap)
{
long int args[4];
@@ -2090,9 +2099,9 @@ static int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
*addrlen = len;
}
- ret = swrap.fns.libc_getsockname(fd,
- (struct sockaddr *)(void *)&un_my_addr,
- &un_my_addrlen);
+ ret = libc_getsockname(fd,
+ (struct sockaddr *)(void *)&un_my_addr,
+ &un_my_addrlen);
if (ret == -1) {
free(child_fi);
free(child_si);
@@ -2445,7 +2454,7 @@ static int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen)
struct socket_info *si = find_socket_info(s);
if (!si) {
- return swrap.fns.libc_getsockname(s, name, addrlen);
+ return libc_getsockname(s, name, addrlen);
}
memcpy(name, si->myname, si->myname_len);