diff options
Diffstat (limited to 'native/jni/java-nio/gnu_java_nio_VMSelector.c')
-rw-r--r-- | native/jni/java-nio/gnu_java_nio_VMSelector.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/native/jni/java-nio/gnu_java_nio_VMSelector.c b/native/jni/java-nio/gnu_java_nio_VMSelector.c index f8a40aa7a..74a408c75 100644 --- a/native/jni/java-nio/gnu_java_nio_VMSelector.c +++ b/native/jni/java-nio/gnu_java_nio_VMSelector.c @@ -219,7 +219,7 @@ Java_gnu_java_nio_VMSelector_select (JNIEnv * env, fd_set except_fds; struct timeval real_time_data; struct timeval *time_data = NULL; - char message_buf[BUF_SIZE + 1]; + char *message; /* If a legal timeout value isn't given, use NULL. * This means an infinite timeout. The specification @@ -270,7 +270,8 @@ Java_gnu_java_nio_VMSelector_select (JNIEnv * env, if (result < 0) { - +#if defined(HAVE_STRERROR_R) + char message_buf[BUF_SIZE+1]; int errorcode = -result; if (strerror_r (errorcode, message_buf, BUF_SIZE)) @@ -283,7 +284,12 @@ Java_gnu_java_nio_VMSelector_select (JNIEnv * env, return 0; } - JCL_ThrowException (env, "java/io/IOException", message_buf); + message = message_buf; +#else + message = strerror(errno); +#endif + + JCL_ThrowException (env, "java/io/IOException", message); return 0; } |