From 9368dd2accb76e2c21097ba77f304347145fff51 Mon Sep 17 00:00:00 2001 From: Eric Scharff Date: Sun, 7 Oct 2007 11:35:48 -0600 Subject: [PATCH] Fix another off-by-one error when EOS is hit on the socket --- classpath/java/nio/channels/SocketChannel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classpath/java/nio/channels/SocketChannel.java b/classpath/java/nio/channels/SocketChannel.java index 01eab5283f..6c4738385a 100644 --- a/classpath/java/nio/channels/SocketChannel.java +++ b/classpath/java/nio/channels/SocketChannel.java @@ -58,7 +58,9 @@ public class SocketChannel extends SelectableChannel natThrowWriteError(socket); } int w = natWrite(socket, b.array(), b.arrayOffset() + b.position(), b.remaining()); - b.position(b.position() + w); + if (w > 0) { + b.position(b.position() + w); + } return w; }