src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c

Print this page

        

*** 306,330 **** } JNIEXPORT jbyteArray Java_sun_nio_fs_UnixNativeDispatcher_strerror(JNIEnv* env, jclass this, jint error) { ! char* msg; jsize len; jbyteArray bytes; ! #ifdef _AIX ! /* strerror() is not thread-safe on AIX so we have to use strerror_r() */ ! char buffer[256]; ! msg = (strerror_r((int)error, buffer, 256) == 0) ? buffer : "Error while calling strerror_r"; ! #else ! msg = strerror((int)error); ! #endif ! len = strlen(msg); bytes = (*env)->NewByteArray(env, len); if (bytes != NULL) { ! (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)msg); } return bytes; } JNIEXPORT jint --- 306,324 ---- } JNIEXPORT jbyteArray Java_sun_nio_fs_UnixNativeDispatcher_strerror(JNIEnv* env, jclass this, jint error) { ! char tmpbuf[1024]; jsize len; jbyteArray bytes; ! getErrorString((int)errno, tmpbuf, sizeof(tmpbuf)); ! len = strlen(tmpbuf); bytes = (*env)->NewByteArray(env, len); if (bytes != NULL) { ! (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)tmpbuf); } return bytes; } JNIEXPORT jint