Index: native/jni/java-nio/gnu_java_nio_VMSelector.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c,v retrieving revision 1.6 diff -b -B -u -r1.6 gnu_java_nio_VMSelector.c --- native/jni/java-nio/gnu_java_nio_VMSelector.c 29 Mar 2005 18:06:05 -0000 1.6 +++ native/jni/java-nio/gnu_java_nio_VMSelector.c 3 Apr 2005 15:04:56 -0000 @@ -157,13 +157,15 @@ r = select (n, readfds, writefds, exceptfds, timeout ? &delay : NULL); - if (r != -1 || errno != EINTR) + if (r < 0 && errno != EINTR) + return -errno; + else if (r >= 0) return r; /* Here we know we got EINTR. */ if ( (*env)->CallStaticBooleanMethod(env, thread_class, thread_interrupted) ) { - return EINTR; + return -EINTR; } if (timeout) @@ -246,7 +248,7 @@ result = helper_select (env, thread_class, thread_interrupted, max_fd + 1, &read_fds, &write_fds, &except_fds, time_data); - if( result == EINTR ) { + if( result == -EINTR ) { /* The behavior of JRE 1.4.1 is that no exception is thrown * when the thread is interrupted, but the thread's interrupt * status is set. Clear all of our select sets and return 0, @@ -262,9 +264,11 @@ return 0; } - if (result < 0) - { - if( strerror_r(errno, message_buf, BUF_SIZE) ) + if (result < 0) { + + int errorcode = -result; + + if( strerror_r(errorcode, message_buf, BUF_SIZE) ) { /* This would mean that message_buf was to small * to hold the error message.