diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 13:54:17 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 13:54:17 +0100 |
commit | 5387e90765707cc14c8d6d010134ec8c452570f7 (patch) | |
tree | 18d6bd9cda2cc0de8b8d4ac41f5e830882a64145 | |
parent | d5581e77abb06960868798f2f5f2263626d57003 (diff) | |
download | socket_wrapper-5387e90765707cc14c8d6d010134ec8c452570f7.tar.gz socket_wrapper-5387e90765707cc14c8d6d010134ec8c452570f7.tar.xz socket_wrapper-5387e90765707cc14c8d6d010134ec8c452570f7.zip |
swrap: Use swrap structure for socket.
-rw-r--r-- | src/socket_wrapper.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index ede9829..1035ecd 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -561,17 +561,6 @@ static int libc_vioctl(int d, unsigned long int request, va_list ap) return rc; } -static int (*libc_socket)(int domain, int type, int protocol); - -static int real_socket(int domain, int type, int protocol) -{ - if (libc_socket == NULL) { - *(void **)(&libc_socket) = libc_dlsym("socket"); - } - - return libc_socket(domain, type, protocol); -} - static ssize_t (*libc_writev)(int fd, const struct iovec *iov, int iovcnt); static ssize_t real_writev(int fd, const struct iovec *iov, int iovcnt) @@ -1847,7 +1836,7 @@ static int swrap_socket(int family, int type, int protocol) #endif break; case AF_UNIX: - return real_socket(family, type, protocol); + return swrap.fns.libc_socket(family, type, protocol); default: errno = EAFNOSUPPORT; return -1; @@ -1881,9 +1870,11 @@ static int swrap_socket(int family, int type, int protocol) return -1; } - /* We must call real_socket with type, from the caller, not the version we removed - SOCK_CLOEXEC and SOCK_NONBLOCK from */ - fd = real_socket(AF_UNIX, type, 0); + /* + * We must call libc_socket with type, from the caller, not the version + * we removed SOCK_CLOEXEC and SOCK_NONBLOCK from + */ + fd = swrap.fns.libc_socket(AF_UNIX, type, 0); if (fd == -1) return -1; |