bug-gnulib
[Top][All Lists]
Advanced

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

ioctl on native Windows


From: Bruno Haible
Subject: ioctl on native Windows
Date: Sat, 04 Feb 2012 16:41:08 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

On native Windows platforms, there is this failure:

  test-ioctl.c:38: assertion failed
  FAIL: test-ioctl.exe

This patch fixes it.


2012-02-04  Bruno Haible  <address@hidden>

        ioctl: Fix test failure on native Windows.
        * lib/ioctl.c: Include msvc-nothrow.h.
        (primary_ioctl): If fd is not a valid handle, set errno to EBADF.

--- lib/ioctl.c.orig    Sat Feb  4 16:37:44 2012
+++ lib/ioctl.c Sat Feb  4 16:34:47 2012
@@ -47,6 +47,8 @@
 # include <errno.h>
 
 # include "fd-hook.h"
+/* Get _get_osfhandle.  */
+# include "msvc-nothrow.h"
 
 static int
 primary_ioctl (int fd, int request, void *arg)
@@ -55,7 +57,10 @@
      fds non-blocking, use the gnulib 'nonblocking' module, until
      gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
 
-  errno = ENOSYS;
+  if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE)
+    errno = ENOSYS;
+  else
+    errno = EBADF;
   return -1;
 }
 




reply via email to

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