diff options
| author | Andreas Schneider <asn@cryptomilk.org> | 2013-02-08 15:50:01 +0100 |
|---|---|---|
| committer | Andreas Schneider <asn@cryptomilk.org> | 2013-02-08 15:50:01 +0100 |
| commit | 72fba61eb487330904895a2711c23f7909c4f233 (patch) | |
| tree | 04645eb4f9325e87db7953f74346f3c0951ea3e3 /src | |
| parent | e7cd219d9c6408562e6d35b41ca914d7c74fc159 (diff) | |
| download | socket_wrapper-72fba61eb487330904895a2711c23f7909c4f233.tar.gz socket_wrapper-72fba61eb487330904895a2711c23f7909c4f233.tar.xz socket_wrapper-72fba61eb487330904895a2711c23f7909c4f233.zip | |
Add listen() wrapper.
Diffstat (limited to 'src')
| -rw-r--r-- | src/socket_wrapper.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index edf7323..e0913b3 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -225,6 +225,18 @@ static int real_getsockname(int sockfd, return libc_getsockname(sockfd, addr, addrlen); } +static int (*libc_listen)(int sockfd, int backlog); + +static int real_listen(int sockfd, int backlog) +{ + if (libc_listen == NULL) { + *(void **)(&libc_listen) = libc_dlsym("listen"); + } + + return libc_listen(sockfd, backlog); +} + + static int (*libc_socket)(int domain, int type, int protocol); static int real_socket(int domain, int type, int protocol) @@ -1913,8 +1925,7 @@ int bind(int s, const struct sockaddr *myaddr, socklen_t addrlen) return ret; } -#if 0 -_PUBLIC_ int swrap_listen(int s, int backlog) +int listen(int s, int backlog) { int ret; struct socket_info *si = find_socket_info(s); @@ -1928,6 +1939,7 @@ _PUBLIC_ int swrap_listen(int s, int backlog) return ret; } +#if 0 _PUBLIC_ int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen) { struct socket_info *si = find_socket_info(s); |
