src/solaris/native/java/net/Inet4AddressImpl.c

Print this page

        

*** 379,388 **** --- 379,397 ---- * send it */ n = sendto(fd, sendbuf, plen, 0, (struct sockaddr *)him, sizeof(struct sockaddr)); if (n < 0 && errno != EINPROGRESS ) { + #ifdef __linux__ + if (errno == EINVAL) { + /* + * On some Linuxes, when bound to the loopback interface, sendto + * will fail and errno will be set to EINVAL. When that happens, + * don't throw an exception, just return false. + */ + } else + #endif /*__linux__ */ NET_ThrowNew(env, errno, "Can't send ICMP packet"); close(fd); return JNI_FALSE; }