aboutsummaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2006-07-18 23:20:26 +0000
committerGreg Lewis <glewis@FreeBSD.org>2006-07-18 23:20:26 +0000
commitc9d5a55e9878ab85af31a6f0dd45ac2e13f9d73b (patch)
treeabf6722a554d71372e855b9516a4d56b8aed0819 /java
parent7c58e0c63eb50eb4a303f4a9373fabdd3bfc51c1 (diff)
downloadports-c9d5a55e9878ab85af31a6f0dd45ac2e13f9d73b.tar.gz
ports-c9d5a55e9878ab85af31a6f0dd45ac2e13f9d73b.zip
. Properly deal with error cases in transferTo0().
Corrects non-blocking IO case. Submitted by: Kurt Miller <kurt@intricatesoftware.com> Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=168175
Diffstat (limited to 'java')
-rw-r--r--java/jdk15/files/patch-j2se::nio::ch::FileChannelImpl.c38
-rw-r--r--java/jdk16/files/patch-j2se::nio::ch::FileChannelImpl.c38
2 files changed, 76 insertions, 0 deletions
diff --git a/java/jdk15/files/patch-j2se::nio::ch::FileChannelImpl.c b/java/jdk15/files/patch-j2se::nio::ch::FileChannelImpl.c
new file mode 100644
index 000000000000..8dea374d17f3
--- /dev/null
+++ b/java/jdk15/files/patch-j2se::nio::ch::FileChannelImpl.c
@@ -0,0 +1,38 @@
+$FreeBSD$
+
+--- ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c.orig Fri Jul 7 10:47:18 2006
++++ ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c Fri Jul 7 14:48:06 2006
+@@ -273,14 +273,28 @@
+ free(buf);
+
+ /*
+- * XXXBSD: there're potential problems with NBIO fd's. Check it.
++ * Similar to solaris if we've transferred any data return
++ * the number of bytes and ignore any error
++ */
++ if (offset - (off_t)position > 0)
++ return (offset - (off_t)position);
++
++ /*
++ * Deal with NBIO EAGAIN & EINTR the same as solaris.
+ */
+ if (r == -1 || w == -1) {
+- fprintf(stderr, "%d %d %d %d %d\n", srcFD, dstFD, r, w, errno);
+- JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+- return IOS_THROWN;
++ switch (errno) {
++ case EAGAIN:
++ return IOS_UNAVAILABLE;
++ case EINTR:
++ return IOS_INTERRUPTED;
++ default:
++ JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
++ return IOS_THROWN;
++ }
+ }
+- return (offset - (off_t)position);
++
++ return (0);
+ #endif
+ }
+
diff --git a/java/jdk16/files/patch-j2se::nio::ch::FileChannelImpl.c b/java/jdk16/files/patch-j2se::nio::ch::FileChannelImpl.c
new file mode 100644
index 000000000000..8dea374d17f3
--- /dev/null
+++ b/java/jdk16/files/patch-j2se::nio::ch::FileChannelImpl.c
@@ -0,0 +1,38 @@
+$FreeBSD$
+
+--- ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c.orig Fri Jul 7 10:47:18 2006
++++ ../../j2se/src/solaris/native/sun/nio/ch/FileChannelImpl.c Fri Jul 7 14:48:06 2006
+@@ -273,14 +273,28 @@
+ free(buf);
+
+ /*
+- * XXXBSD: there're potential problems with NBIO fd's. Check it.
++ * Similar to solaris if we've transferred any data return
++ * the number of bytes and ignore any error
++ */
++ if (offset - (off_t)position > 0)
++ return (offset - (off_t)position);
++
++ /*
++ * Deal with NBIO EAGAIN & EINTR the same as solaris.
+ */
+ if (r == -1 || w == -1) {
+- fprintf(stderr, "%d %d %d %d %d\n", srcFD, dstFD, r, w, errno);
+- JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+- return IOS_THROWN;
++ switch (errno) {
++ case EAGAIN:
++ return IOS_UNAVAILABLE;
++ case EINTR:
++ return IOS_INTERRUPTED;
++ default:
++ JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
++ return IOS_THROWN;
++ }
+ }
+- return (offset - (off_t)position);
++
++ return (0);
+ #endif
+ }
+