--- old/src/java.base/unix/native/libjava/jni_util_md.c Mon Sep 21 16:48:38 2015 +++ new/src/java.base/unix/native/libjava/jni_util_md.c Mon Sep 21 16:48:38 2015 @@ -26,6 +26,7 @@ #include #include +#include "jdk_strerror.h" #include "jni.h" #include "jni_util.h" #include "dlfcn.h" @@ -55,16 +56,17 @@ size_t getLastErrorString(char *buf, size_t len) { - char *err; - size_t n; + char tmpbuf[1024]; + int n = 0; + if (errno == 0 || len < 1) return 0; - err = strerror(errno); - n = strlen(err); - if (n >= len) - n = len - 1; + jdk_strerror(errno, tmpbuf, (size_t) 1024); + n = strlen(tmpbuf); + if (n >= (int) len) + n = (int) len - 1; - strncpy(buf, err, n); + strncpy(buf, tmpbuf, n); buf[n] = '\0'; return n; }