changeset 892:043dfafc41a5

6799040: Portability issues in src/solaris/native/java/net/Inet4AddressImpl.c Reviewed-by: alanb Contributed-by: christos@zoulas.com
author chegar
date Wed, 11 Feb 2009 13:16:53 +0000
parents 40ce81649cd6
children f06f30b29f36
files src/solaris/native/java/net/Inet4AddressImpl.c src/solaris/native/java/net/Inet6AddressImpl.c
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/net/Inet4AddressImpl.c	Tue Feb 10 03:26:31 2009 -0800
+++ b/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/src/solaris/native/java/net/Inet6AddressImpl.c	Tue Feb 10 03:26:31 2009 -0800
+++ b/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;