diff options
author | Elliott Hughes <enh@google.com> | 2011-05-24 17:01:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-24 17:01:36 -0700 |
commit | ad98d26fe40962b37ed3992a6106f7e673b72450 (patch) | |
tree | e769ef23be5dd160048c6dfb18f8ae3fa6a8c5f5 /luni | |
parent | 917753d34de3aaf43bc4f3b4e851bccfe3595f82 (diff) | |
parent | f1a10948c7e4caf5a6d9d53b4b3ad99580fc1cea (diff) | |
download | libcore-ad98d26fe40962b37ed3992a6106f7e673b72450.zip libcore-ad98d26fe40962b37ed3992a6106f7e673b72450.tar.gz libcore-ad98d26fe40962b37ed3992a6106f7e673b72450.tar.bz2 |
Merge "Fix a couple of FileChannel bugs." into dalvik-dev
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/main/java/java/nio/FileChannelImpl.java | 3 | ||||
-rw-r--r-- | luni/src/main/java/java/nio/IoVec.java | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/luni/src/main/java/java/nio/FileChannelImpl.java b/luni/src/main/java/java/nio/FileChannelImpl.java index 379c99f..53c1e4d 100644 --- a/luni/src/main/java/java/nio/FileChannelImpl.java +++ b/luni/src/main/java/java/nio/FileChannelImpl.java @@ -297,6 +297,9 @@ final class FileChannelImpl extends FileChannel { begin(); try { bytesRead = Libcore.os.read(fd, buffer); + if (bytesRead == 0) { + bytesRead = -1; + } } catch (ErrnoException errnoException) { if (errnoException.errno == EAGAIN) { // We don't throw if we try to read from an empty non-blocking pipe. diff --git a/luni/src/main/java/java/nio/IoVec.java b/luni/src/main/java/java/nio/IoVec.java index 948e658..e548548 100644 --- a/luni/src/main/java/java/nio/IoVec.java +++ b/luni/src/main/java/java/nio/IoVec.java @@ -92,7 +92,7 @@ final class IoVec { b.position(b.limit()); byteCount -= byteCounts[i]; } else { - b.position((direction == Direction.WRITEV ? b.position() : 0) + byteCounts[i]); + b.position((direction == Direction.WRITEV ? b.position() : 0) + byteCount); byteCount = 0; } } |