static int
-not_here(char *s)
+not_here(const char *s)
{
croak("Socket::%s not implemented on this architecture", s);
return -1;
{
struct in_addr ip_address;
struct hostent * phe;
- int ok =
- (host != NULL) &&
- (*host != '\0') &&
- inet_aton(host, &ip_address);
+ int ok = (*host != '\0') && inet_aton(host, &ip_address);
- if (!ok && (phe = gethostbyname(host))) {
+ if (!ok && (phe = gethostbyname(host)) &&
+ phe->h_addrtype == AF_INET && phe->h_length == 4) {
Copy( phe->h_addr, &ip_address, phe->h_length, char );
ok = 1;
}
* in HP-UX + GCC + 64bitint (returns "0.0.0.0"),
* so let's use this sprintf() workaround everywhere.
* This is also more threadsafe than using inet_ntoa(). */
- New(1138, addr_str, 4 * 3 + 3 + 1, char); /* IPv6? */
+ Newx(addr_str, 4 * 3 + 3 + 1, char); /* IPv6? */
sprintf(addr_str, "%d.%d.%d.%d",
((addr.s_addr >> 24) & 0xFF),
((addr.s_addr >> 16) & 0xFF),