From de8096cf4822983d870d6ee7c008d9cc282c45d7 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 27 Mar 2009 16:04:05 +0000 Subject: [PATCH] 6772303: (se) IOException: Invalid argument" thrown on a call to Selector.select(value) with -d64 Reviewed-by: sherman --- jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c b/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c index 090c77e6774..fa36f612bff 100644 --- a/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c +++ b/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c @@ -28,6 +28,7 @@ #include "jvm.h" #include "jlong.h" #include "sun_nio_ch_DevPollArrayWrapper.h" +#include "java_lang_Integer.h" #include #include #include @@ -192,7 +193,11 @@ Java_sun_nio_ch_DevPollArrayWrapper_fdLimit(JNIEnv *env, jclass this) JNU_ThrowIOExceptionWithLastError(env, "getrlimit failed"); } - return (jint)rlp.rlim_max; + if (rlp.rlim_max < 0 || rlp.rlim_max > java_lang_Integer_MAX_VALUE) { + return java_lang_Integer_MAX_VALUE; + } else { + return (jint)rlp.rlim_max; + } } JNIEXPORT void JNICALL