6799040: Portability issues in src/solaris/native/java/net/Inet4AddressImpl.c
Reviewed-by: alanb
Contributed-by: christos@zoulas.com
--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c Tue Feb 10 03:26:31 2009 -0800
+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c Wed Feb 11 13:16:53 2009 +0000
@@ -165,16 +165,18 @@
hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
CHECK_NULL_RETURN(hostname, NULL);
+#ifdef __solaris__
/*
* Workaround for Solaris bug 4160367 - if a hostname contains a
* white space then 0.0.0.0 is returned
*/
- if (isspace(hostname[0])) {
+ if (isspace((unsigned char)hostname[0])) {
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
(char *)hostname);
JNU_ReleaseStringPlatformChars(env, host, hostname);
return NULL;
}
+#endif
/* Try once, with our static buffer. */
#ifdef __GLIBC__
@@ -325,7 +327,8 @@
ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
struct sockaddr_in* netif, jint ttl) {
jint size;
- jint n, len, hlen1, icmplen;
+ jint n, hlen1, icmplen;
+ socklen_t len;
char sendbuf[1500];
char recvbuf[1500];
struct icmp *icmp;
--- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c Tue Feb 10 03:26:31 2009 -0800
+++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c Wed Feb 11 13:16:53 2009 +0000
@@ -196,16 +196,18 @@
hints.ai_flags = AI_CANONNAME;
hints.ai_family = AF_UNSPEC;
+#ifdef __solaris__
/*
* Workaround for Solaris bug 4160367 - if a hostname contains a
* white space then 0.0.0.0 is returned
*/
- if (isspace(hostname[0])) {
+ if (isspace((unsigned char)hostname[0])) {
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
(char *)hostname);
JNU_ReleaseStringPlatformChars(env, host, hostname);
return NULL;
}
+#endif
error = (*getaddrinfo_ptr)(hostname, NULL, &hints, &res);
@@ -455,7 +457,8 @@
ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
struct sockaddr_in6* netif, jint ttl) {
jint size;
- jint n, len;
+ jint n;
+ socklen_t len;
char sendbuf[1500];
unsigned char recvbuf[1500];
struct icmp6_hdr *icmp6;