summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-05 12:17:27 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-05 13:43:45 +0100
commita1e494ba5d4a7badafc0c3debfddfd9f6d3e4e61 (patch)
treea546d7e51261bf985542717b81ef288c6b9254c4
parente0767c253ec920044c93b8c14cdf64e953fc8e49 (diff)
downloadsocket_wrapper-a1e494ba5d4a7badafc0c3debfddfd9f6d3e4e61.zip
socket_wrapper-a1e494ba5d4a7badafc0c3debfddfd9f6d3e4e61.tar.gz
socket_wrapper-a1e494ba5d4a7badafc0c3debfddfd9f6d3e4e61.tar.xz
swrap: Use swrap structure for ioctl.
-rw-r--r--src/socket_wrapper.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 1bb23ef..2f2fc1a 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -541,22 +541,22 @@ static void *libc_dlsym(const char *name)
return func;
}
-static int (*libc_ioctl)(int d, unsigned long int request, ...);
-
-static int real_vioctl(int d, unsigned long int request, va_list ap) {
+static int libc_vioctl(int d, unsigned long int request, va_list ap)
+{
long int args[4];
int rc;
int i;
- if (libc_ioctl == NULL) {
- *(void **)(&libc_ioctl) = libc_dlsym("ioctl");
- }
-
for (i = 0; i < 4; i++) {
args[i] = va_arg(ap, long int);
}
- rc = libc_ioctl(d, request, args[0], args[1], args[2], args[3]);
+ rc = swrap.fns.libc_ioctl(d,
+ request,
+ args[0],
+ args[1],
+ args[2],
+ args[3]);
return rc;
}
@@ -2582,12 +2582,12 @@ static int swrap_vioctl(int s, unsigned long int r, va_list va)
int rc;
if (!si) {
- return real_vioctl(s, r, va);
+ return libc_vioctl(s, r, va);
}
va_copy(ap, va);
- rc = real_vioctl(s, r, va);
+ rc = libc_vioctl(s, r, va);
switch (r) {
case FIONREAD: