jdk/src/solaris/native/java/net/Inet4AddressImpl.c
changeset 2056 115e09b7a004
parent 910 1f53246fb014
child 3226 b142b3d06bf5
equal deleted inserted replaced
2055:e3166b387ec5 2056:115e09b7a004
   163         return 0;
   163         return 0;
   164     }
   164     }
   165     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
   165     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
   166     CHECK_NULL_RETURN(hostname, NULL);
   166     CHECK_NULL_RETURN(hostname, NULL);
   167 
   167 
       
   168 #ifdef __solaris__
   168     /*
   169     /*
   169      * Workaround for Solaris bug 4160367 - if a hostname contains a
   170      * Workaround for Solaris bug 4160367 - if a hostname contains a
   170      * white space then 0.0.0.0 is returned
   171      * white space then 0.0.0.0 is returned
   171      */
   172      */
   172     if (isspace(hostname[0])) {
   173     if (isspace((unsigned char)hostname[0])) {
   173         JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
   174         JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
   174                         (char *)hostname);
   175                         (char *)hostname);
   175         JNU_ReleaseStringPlatformChars(env, host, hostname);
   176         JNU_ReleaseStringPlatformChars(env, host, hostname);
   176         return NULL;
   177         return NULL;
   177     }
   178     }
       
   179 #endif
   178 
   180 
   179     /* Try once, with our static buffer. */
   181     /* Try once, with our static buffer. */
   180 #ifdef __GLIBC__
   182 #ifdef __GLIBC__
   181     gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error);
   183     gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error);
   182 #else
   184 #else
   323  */
   325  */
   324 static jboolean
   326 static jboolean
   325 ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
   327 ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
   326       struct sockaddr_in* netif, jint ttl) {
   328       struct sockaddr_in* netif, jint ttl) {
   327     jint size;
   329     jint size;
   328     jint n, len, hlen1, icmplen;
   330     jint n, hlen1, icmplen;
       
   331     socklen_t len;
   329     char sendbuf[1500];
   332     char sendbuf[1500];
   330     char recvbuf[1500];
   333     char recvbuf[1500];
   331     struct icmp *icmp;
   334     struct icmp *icmp;
   332     struct ip *ip;
   335     struct ip *ip;
   333     struct sockaddr_in sa_recv;
   336     struct sockaddr_in sa_recv;