src/solaris/native/java/io/io_util_md.c
Print this page
rev 7704 : 8016579: (process) IOException thrown by ProcessBuilder.start() method is incorrectly encoded
*** 116,120 ****
--- 116,135 ----
}
} else if (JVM_Close(fd) == -1) {
JNU_ThrowIOExceptionWithLastError(env, "close failed");
}
}
+
+ size_t
+ getLastErrorString(char *buf, size_t len)
+ {
+ if (errno == 0 || len < 1) return 0;
+
+ const char *err = strerror(errno);
+ size_t n = strlen(err);
+ if (n >= len)
+ n = len - 1;
+
+ strncpy(buf, err, n);
+ buf[n] = '\0';
+ return n;
+ }