From: Ranjit Mathew Date: Tue, 11 Feb 2003 20:55:26 +0000 (+0000) Subject: 2003-02-11 Ranjit Mathew X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=668ec0830302d6b3a27c4cd2801d275cefbd7f31;p=gcc.git 2003-02-11 Ranjit Mathew * java/io/natFileDescriptorWin32.cc (java::io::FileDescriptor::read): Return -1 (EOF) if ReadFile( ) returns with Win32 error code ERROR_BROKEN_PIPE. From-SVN: r62722 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 0490ac796fe..46dab6412fa 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-02-11 Ranjit Mathew + + * java/io/natFileDescriptorWin32.cc + (java::io::FileDescriptor::read): Return -1 (EOF) if ReadFile( ) + returns with Win32 error code ERROR_BROKEN_PIPE. + 2003-02-11 Michael Koch * Makefile.in diff --git a/libjava/java/io/natFileDescriptorWin32.cc b/libjava/java/io/natFileDescriptorWin32.cc index 4b157f7042c..87f94e81222 100644 --- a/libjava/java/io/natFileDescriptorWin32.cc +++ b/libjava/java/io/natFileDescriptorWin32.cc @@ -1,6 +1,7 @@ // natFileDescriptorWin32.cc - Native part of FileDescriptor class. -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software + Foundation, Inc. This file is part of libgcj. @@ -288,7 +289,13 @@ java::io::FileDescriptor::read(void) DWORD read; if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL)) - throw new IOException (JvNewStringLatin1 (winerr ())); + { + if (GetLastError () == ERROR_BROKEN_PIPE) + return -1; + else + throw new IOException (JvNewStringLatin1 (winerr ())); + } + if (! read) return -1; else @@ -313,9 +320,15 @@ java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count) DWORD read; if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL)) - throw new IOException (JvNewStringLatin1 (winerr ())); + { + if (GetLastError () == ERROR_BROKEN_PIPE) + return -1; + else + throw new IOException (JvNewStringLatin1 (winerr ())); + } if (read == 0) return -1; + return (jint)read; }