summaryrefslogtreecommitdiffstats
path: root/0004-Cygwin-ioctl-may-emit-EINVAL.patch
blob: e46d4aa9f50e96884d3ac548e6a657fbee9f8d9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From f590da14fcd201f8f2a1538523a6cfc279861842 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Sat, 28 Jun 2014 08:37:16 +0800
Subject: [PATCH 04/21] Cygwin ioctl may emit EINVAL

On Cygwin (on X86) ioctl on FIONREAD returns EINVAL on the errno variable instead of ENOTTY
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35536
---
 libjava/gnu/java/nio/channels/natFileChannelPosix.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libjava/gnu/java/nio/channels/natFileChannelPosix.cc b/libjava/gnu/java/nio/channels/natFileChannelPosix.cc
index e05904c..0a2569c 100644
--- a/libjava/gnu/java/nio/channels/natFileChannelPosix.cc
+++ b/libjava/gnu/java/nio/channels/natFileChannelPosix.cc
@@ -386,7 +386,7 @@ FileChannelImpl::available (void)
 
 #if defined (FIONREAD)
   r = ::ioctl (fd, FIONREAD, &num);
-  if (r == -1 && errno == ENOTTY)
+  if (r == -1 && (errno == ENOTTY || errno == EINVAL))
     {
       // If the ioctl doesn't work, we don't care.
       r = 0;
-- 
2.4.5