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