jdk/src/java.base/unix/native/libnio/ch/Net.c
changeset 32014 262d30f45454
parent 32006 97c6167e698a
child 36115 0676e37a0b9c
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c	Mon Aug 03 09:25:02 2015 +0800
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c	Mon Aug 03 10:25:38 2015 -0700
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
+#include <limits.h>
 
 #include "jni.h"
 #include "jni_util.h"
@@ -709,7 +710,12 @@
     int rv;
     pfd.fd = fdval(env, fdo);
     pfd.events = events;
-    rv = poll(&pfd, 1, timeout);
+    if (timeout < -1) {
+        timeout = -1;
+    } else if (timeout > INT_MAX) {
+        timeout = INT_MAX;
+    }
+    rv = poll(&pfd, 1, (int)timeout);
 
     if (rv >= 0) {
         return pfd.revents;