From 6caa8f09c486117255d389016afbac511454e6a3 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Fri, 15 Jul 2016 20:57:41 +0100 Subject: [PATCH] 8157749: Improve handling of DNS error replies Reviewed-by: chegar, rriggs, coffeys --- jdk/src/java.base/unix/native/libnet/net_util_md.c | 5 +---- jdk/src/java.base/windows/native/libnet/net_util_md.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) 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