diff --git a/jdk/src/java.base/unix/native/libnet/net_util_md.c b/jdk/src/java.base/unix/native/libnet/net_util_md.c index 4fe4950c362..13b97dcbc9a 100644 --- a/jdk/src/java.base/unix/native/libnet/net_util_md.c +++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c @@ -273,13 +273,10 @@ int cmpScopeID (unsigned int scope, struct sockaddr *him) { #endif - void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, const char *defaultDetail) { - char errmsg[255]; - sprintf(errmsg, "errno: %d, error: %s\n", errno, defaultDetail); - JNU_ThrowByNameWithLastError(env, name, errmsg); + JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail); } void diff --git a/jdk/src/java.base/windows/native/libnet/net_util_md.c b/jdk/src/java.base/windows/native/libnet/net_util_md.c index 523ea18523d..0afbe08b881 100644 --- a/jdk/src/java.base/windows/native/libnet/net_util_md.c +++ b/jdk/src/java.base/windows/native/libnet/net_util_md.c @@ -205,9 +205,7 @@ NET_ThrowCurrent(JNIEnv *env, char *msg) void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, const char *defaultDetail) { - char errmsg[255]; - sprintf(errmsg, "errno: %d, error: %s\n", WSAGetLastError(), defaultDetail); - JNU_ThrowByNameWithLastError(env, name, errmsg); + JNU_ThrowByNameWithMessageAndLastError(env, name, defaultDetail); } jfieldID