--- old/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c Mon Sep 21 16:48:44 2015 +++ new/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c Mon Sep 21 16:48:43 2015 @@ -45,6 +45,7 @@ #include "NetworkInterface.h" #include "jvm.h" +#include "jdk_strerror.h" #include "jni_util.h" #include "net_util.h" @@ -2168,6 +2169,7 @@ int fd=-1, fd1=-1; int level, optname, optlen; + char buf[1024]; union { int i; } optval = {0}; @@ -2211,8 +2213,10 @@ optlen = sizeof(optval.i); if (NET_GetSockOpt(fd, level, optname, (void *)&optval, &optlen) < 0) { - char errmsg[255]; - sprintf(errmsg, "error getting socket option: %s\n", strerror(errno)); + int size = 0; + char errmsg[300]; + jdk_strerror(errno, buf, (size_t) 255); + sprintf(errmsg, "error getting socket option: %s\n", buf); JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", errmsg); return NULL; }