From 9e63878c72a554e74801cf0855729d8be649a9f5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 10 Oct 2008 04:17:02 +0200 Subject: [PATCH] Make the ioctl() signature POSIX compliant. --- ChangeLog | 6 ++++++ lib/sys_socket.in.h | 2 +- lib/winsock.c | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7dc92bd3..1a778b0eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-10-09 Bruno Haible + * lib/sys_socket.in.h (ioctl): Make signature POSIX compliant. + * lib/winsock.c: Include . + (rpl_ioctl): Change to second argument 'int' and then varargs. + +2008-10-09 Bruno Haible + * m4/close.m4 (gl_FUNC_CLOSE): Arrange to replace the close() function when the sys_socket module is present and the system has . diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index 74cb37a98..ddc4264ea 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -282,7 +282,7 @@ extern int rpl_listen (int, int); # if @HAVE_WINSOCK2_H@ # undef ioctl # define ioctl rpl_ioctl -extern int rpl_ioctl (int, unsigned long, char *); +extern int rpl_ioctl (int, int, ...); # endif # if @GNULIB_RECV@ diff --git a/lib/winsock.c b/lib/winsock.c index feee00d54..53b9336b9 100644 --- a/lib/winsock.c +++ b/lib/winsock.c @@ -18,6 +18,7 @@ /* Written by Paolo Bonzini */ #include +#include #include #include #include @@ -224,10 +225,19 @@ rpl_listen (int fd, int backlog) #endif int -rpl_ioctl (int fd, unsigned long req, char *buf) +rpl_ioctl (int fd, int req, ...) { - SOCKET sock = FD_TO_SOCKET (fd); - int r = ioctlsocket (sock, req, (void *) buf); + void *buf; + va_list args; + SOCKET sock; + int r; + + va_start (args, req); + buf = va_arg (args, void *); + va_end (args); + + sock = FD_TO_SOCKET (fd); + r = ioctlsocket (sock, req, buf); if (r < 0) set_winsock_errno (); -- 2.11.0