summaryrefslogtreecommitdiffstats
path: root/0004-Cygwin-ioctl-may-emit-EINVAL.patch
blob: ff14e3f475169cb3feb32f08628e570c98b5b3f8 (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 4c3499c1009f7051d76ba8b603fdeaa510e5c650 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/24] 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.1.1