src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c

Print this page

        

@@ -2237,12 +2237,15 @@
         fd = fd1; /* must be IPv6 only */
     }
 
     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));
+        char tmpbuf[255];
+        int size = 0;
+        char errmsg[255 + 31];
+        getErrorString(errno, tmpbuf, sizeof(tmpbuf));
+        sprintf(errmsg, "error getting socket option: %s", tmpbuf);
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", errmsg);
         return NULL;
     }
 
     switch (opt) {