Commit 668ec083 by Ranjit Mathew Committed by Tom Tromey

2003-02-11 Ranjit Mathew <rmathew@hotmail.com>

	* java/io/natFileDescriptorWin32.cc
	(java::io::FileDescriptor::read): Return -1 (EOF) if ReadFile( )
	returns with Win32 error code ERROR_BROKEN_PIPE.

From-SVN: r62722
parent 2026dcf9
2003-02-11 Ranjit Mathew <rmathew@hotmail.com>
* 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 <konqueror@gmx.de> 2003-02-11 Michael Koch <konqueror@gmx.de>
* Makefile.in * Makefile.in
......
// natFileDescriptorWin32.cc - Native part of FileDescriptor class. // 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. This file is part of libgcj.
...@@ -288,7 +289,13 @@ java::io::FileDescriptor::read(void) ...@@ -288,7 +289,13 @@ java::io::FileDescriptor::read(void)
DWORD read; DWORD read;
if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL)) if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL))
{
if (GetLastError () == ERROR_BROKEN_PIPE)
return -1;
else
throw new IOException (JvNewStringLatin1 (winerr ())); throw new IOException (JvNewStringLatin1 (winerr ()));
}
if (! read) if (! read)
return -1; return -1;
else else
...@@ -313,9 +320,15 @@ java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count) ...@@ -313,9 +320,15 @@ java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count)
DWORD read; DWORD read;
if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL)) if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL))
{
if (GetLastError () == ERROR_BROKEN_PIPE)
return -1;
else
throw new IOException (JvNewStringLatin1 (winerr ())); throw new IOException (JvNewStringLatin1 (winerr ()));
}
if (read == 0) return -1; if (read == 0) return -1;
return (jint)read; return (jint)read;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment