diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 13:53:01 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 13:53:01 +0100 |
commit | d5581e77abb06960868798f2f5f2263626d57003 (patch) | |
tree | 7e6dd23748ac25ad97527ed78a405fa4f0fa2f0f | |
parent | 156ba02ef15dcdf0d45e3be9fe06fe8acccf5607 (diff) | |
download | socket_wrapper-d5581e77abb06960868798f2f5f2263626d57003.tar.gz socket_wrapper-d5581e77abb06960868798f2f5f2263626d57003.tar.xz socket_wrapper-d5581e77abb06960868798f2f5f2263626d57003.zip |
swrap: Use swrap structure for setsockopt.
-rw-r--r-- | src/socket_wrapper.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 553c604..ede9829 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -561,25 +561,6 @@ static int libc_vioctl(int d, unsigned long int request, va_list ap) return rc; } -static int (*libc_setsockopt)(int sockfd, - int level, - int optname, - const void *optval, - socklen_t optlen); - -static int real_setsockopt(int sockfd, - int level, - int optname, - const void *optval, - socklen_t optlen) -{ - if (libc_setsockopt == NULL) { - *(void **)(&libc_setsockopt) = libc_dlsym("setsockopt"); - } - - return libc_setsockopt(sockfd, level, optname, optval, optlen); -} - static int (*libc_socket)(int domain, int type, int protocol); static int real_socket(int domain, int type, int protocol) @@ -2452,11 +2433,19 @@ static int swrap_setsockopt(int s, int level, int optname, struct socket_info *si = find_socket_info(s); if (!si) { - return real_setsockopt(s, level, optname, optval, optlen); + return swrap.fns.libc_setsockopt(s, + level, + optname, + optval, + optlen); } if (level == SOL_SOCKET) { - return real_setsockopt(s, level, optname, optval, optlen); + return swrap.fns.libc_setsockopt(s, + level, + optname, + optval, + optlen); } switch (si->family) { |