summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-05 12:14:32 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:43:45 +0100
commite0767c253ec920044c93b8c14cdf64e953fc8e49 (patch)
tree6bc90c8e125cef1db4dd97d7bee40ce5ef66d853
parent8745a7f2752a747655499ecc290c91390e4caaa7 (diff)
downloadsocket_wrapper-e0767c253ec920044c93b8c14cdf64e953fc8e49.zip
socket_wrapper-e0767c253ec920044c93b8c14cdf64e953fc8e49.tar.gz
socket_wrapper-e0767c253ec920044c93b8c14cdf64e953fc8e49.tar.xz
swrap: Use swrap structure for getsockopt.
-rw-r--r--src/socket_wrapper.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index e6962d8..1bb23ef 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -541,25 +541,6 @@ static void *libc_dlsym(const char *name)
return func;
}
-static int (*libc_getsockopt)(int sockfd,
- int level,
- int optname,
- void *optval,
- socklen_t *optlen);
-
-static int real_getsockopt(int sockfd,
- int level,
- int optname,
- void *optval,
- socklen_t *optlen)
-{
- if (libc_getsockopt == NULL) {
- *(void **)(&libc_getsockopt) = libc_dlsym("getsockopt");
- }
-
- return libc_getsockopt(sockfd, level, optname, optval, optlen);
-}
-
static int (*libc_ioctl)(int d, unsigned long int request, ...);
static int real_vioctl(int d, unsigned long int request, va_list ap) {
@@ -2525,11 +2506,19 @@ static int swrap_getsockopt(int s, int level, int optname,
struct socket_info *si = find_socket_info(s);
if (!si) {
- return real_getsockopt(s, level, optname, optval, optlen);
+ return swrap.fns.libc_getsockopt(s,
+ level,
+ optname,
+ optval,
+ optlen);
}
if (level == SOL_SOCKET) {
- return real_getsockopt(s, level, optname, optval, optlen);
+ return swrap.fns.libc_getsockopt(s,
+ level,
+ optname,
+ optval,
+ optlen);
}
errno = ENOPROTOOPT;