src/java.base/unix/native/libjava/ProcessImpl_md.c

Print this page

        

@@ -24,10 +24,11 @@
  */
 
 #undef  _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE 1
 
+#include "jdk_strerror.h"
 #include "jni.h"
 #include "jvm.h"
 #include "jvm_md.h"
 #include "jni_util.h"
 #include "io_util.h"

@@ -246,16 +247,17 @@
 throwIOException(JNIEnv *env, int errnum, const char *defaultDetail)
 {
     const char *detail = defaultDetail;
     char *errmsg;
     size_t fmtsize;
+    char buf[1024];
     jstring s;
 
     if (errnum != 0) {
-        const char *s = strerror(errnum);
-        if (strcmp(s, "Unknown error") != 0)
-            detail = s;
+        jdk_strerror(errnum, buf, (size_t) 1024);
+        if (strncmp(buf, "Unknown error", 13) != 0)
+            detail = buf;
     }
     /* ASCII Decimal representation uses 2.4 times as many bits as binary. */
     fmtsize = sizeof(IOE_FORMAT) + strlen(detail) + 3 * sizeof(errnum);
     errmsg = NEW(char, fmtsize);
     if (errmsg == NULL)