bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

winsock: fix ioctl prototype


From: Bruno Haible
Subject: winsock: fix ioctl prototype
Date: Fri, 10 Oct 2008 04:16:39 +0200
User-agent: KMail/1.5.4

According to POSIX <http://www.opengroup.org/susv3/functions/ioctl.html>
the ioctl() prototype takes 'int' as second argument and then varargs.

I'm fixing it like this:

2008-10-09  Bruno Haible  <address@hidden>

        * lib/sys_socket.in.h (ioctl): Make signature POSIX compliant.
        * lib/winsock.c: Include <stdarg.h>.
        (rpl_ioctl): Change to second argument 'int' and then varargs.

*** lib/sys_socket.in.h.orig    2008-10-10 04:14:30.000000000 +0200
--- lib/sys_socket.in.h 2008-10-10 04:12:04.000000000 +0200
***************
*** 282,288 ****
  # if @HAVE_WINSOCK2_H@
  #  undef ioctl
  #  define ioctl                       rpl_ioctl
! extern int rpl_ioctl (int, unsigned long, char *);
  # endif
  
  # if @GNULIB_RECV@
--- 282,288 ----
  # if @HAVE_WINSOCK2_H@
  #  undef ioctl
  #  define ioctl                       rpl_ioctl
! extern int rpl_ioctl (int, int, ...);
  # endif
  
  # if @GNULIB_RECV@
*** lib/winsock.c.orig  2008-10-10 04:14:30.000000000 +0200
--- lib/winsock.c       2008-10-10 04:12:54.000000000 +0200
***************
*** 18,23 ****
--- 18,24 ----
  /* Written by Paolo Bonzini */
  
  #include <config.h>
+ #include <stdarg.h>
  #include <stdio.h>
  #include <string.h>
  #include <errno.h>
***************
*** 224,233 ****
  #endif
  
  int
! rpl_ioctl (int fd, unsigned long req, char *buf)
  {
!   SOCKET sock = FD_TO_SOCKET (fd);
!   int r = ioctlsocket (sock, req, (void *) buf);
    if (r < 0)
      set_winsock_errno ();
  
--- 225,243 ----
  #endif
  
  int
! rpl_ioctl (int fd, int req, ...)
  {
!   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 ();
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]