src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
Print this page
*** 26,35 ****
--- 26,36 ----
#include "jni.h"
#include "jni_util.h"
#include "jvm.h"
#include "jlong.h"
#include "sun_nio_ch_DevPollArrayWrapper.h"
+ #include "java_lang_Integer.h"
#include <sys/poll.h>
#include <sys/resource.h>
#include <unistd.h>
#include <sys/time.h>
*** 190,200 ****
--- 191,205 ----
struct rlimit rlp;
if (getrlimit(RLIMIT_NOFILE, &rlp) < 0) {
JNU_ThrowIOExceptionWithLastError(env,
"getrlimit failed");
}
+ 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
Java_sun_nio_ch_DevPollArrayWrapper_interrupt(JNIEnv *env, jclass this, jint fd)
{