Subject: | [PATCH] respect HAS_GETHOSTBYNAME before using gethostbyname |
On a freak platform configuration without sockets, I noticed Socket uses gethostbyname without testing Config.pm/config.h's HAS_GETHOSTBYNAME. Thus Socket fails at link time with unresolved symbol. This patch lets Socket compile on such a freak platform (I dont care about tests passing on a no sockets configuration).
Subject: | 0001-respect-HAS_GETHOSTBYNAME-before-using-gethostbyname.patch |
From 0b982f2bcabb11d5889fdf7fca2186db57638510 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Sun, 19 Jul 2015 15:38:57 -0400
Subject: [PATCH] respect HAS_GETHOSTBYNAME before using gethostbyname
---
cpan/Socket/Socket.xs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpan/Socket/Socket.xs b/cpan/Socket/Socket.xs
index 50a0f31..28f1ce6 100644
--- a/cpan/Socket/Socket.xs
+++ b/cpan/Socket/Socket.xs
@@ -664,13 +664,13 @@ inet_aton(host)
ST(0) = sv_2mortal(newSVpvn((char *)&ip_address, sizeof(ip_address)));
XSRETURN(1);
}
-
+#ifdef HAS_GETHOSTBYNAME
phe = gethostbyname(host);
if (phe && phe->h_addrtype == AF_INET && phe->h_length == 4) {
ST(0) = sv_2mortal(newSVpvn((char *)phe->h_addr, phe->h_length));
XSRETURN(1);
}
-
+#endif
XSRETURN_UNDEF;
}
--
1.7.9.msysgit.0