In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a5addb167c102dc5dcd1ab886caf0cb4f554eb05?hp=645d8892bdf2a7e5afe985dfd321b2d332930f62>
- Log ----------------------------------------------------------------- commit a5addb167c102dc5dcd1ab886caf0cb4f554eb05 Author: Paul Green <paul.gr...@stratus.com> Date: Sun Oct 3 14:18:17 2010 -0700 Fix perl build problems on Stratus VOS The attached text files contain patches to correct build problems on the Stratus VOS (recently renamed "OpenVOS") operating system. I have tested these changes on OpenVOS Release 17.0, which is the most-current customer release. None of these changes should affect any other OS. Makefile.SH: This patch removes the "miniperl" dependency of the "all" target. On an operating system that does not require an executable suffix, the miniperl$(EXE_EXT) dependency evaluates to "miniperl", too. But on an operating system like VOS that does have an executable suffix, miniperl$(EXE_EXT) evaluates to (in our case) "miniperl.pm" and the "miniperl" target is unresolved. ext/Socket/Socket.xs: Sadly, OpenVOS does not yet support IPv6. I edited the code to allow for this case, while retaining IPv6 support for operating systems that do support it. ----------------------------------------------------------------------- Summary of changes: Makefile.SH | 2 +- ext/Socket/Socket.xs | 49 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Makefile.SH b/Makefile.SH index 0a8a0ae..ab2f202 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -555,7 +555,7 @@ splintfiles = $(c1) .c.s: $(CCCMDSRC) -S $*.c -all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) miniperl $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make +all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make @echo " "; @echo " Everything is up to date. Type '$(MAKE) test' to run test suite." diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index af76554..e2f995b 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -465,22 +465,34 @@ inet_ntop(af, ip_address_sv) CODE: #ifdef HAS_INETNTOP STRLEN addrlen, struct_size; +#ifdef AF_INET6 struct in6_addr addr; char str[INET6_ADDRSTRLEN]; +#else + struct in_addr addr; + char str[INET_ADDRSTRLEN]; +#endif char *ip_address = SvPV(ip_address_sv, addrlen); - if(af == AF_INET) { - struct_size = sizeof(struct in_addr); - } else if(af == AF_INET6) { - struct_size = sizeof(struct in6_addr); - } else { - croak("Bad address family for %s, got %d, should be either AF_INET or AF_INET6", + struct_size = sizeof(addr); + + if(af != AF_INET +#ifdef AF_INET6 + && af != AF_INET6 +#endif + ) { + croak("Bad address family for %s, got %d, should be" +#ifdef AF_INET6 + " either AF_INET or AF_INET6", +#else + " AF_INET", +#endif "Socket::inet_ntop", af); } Copy( ip_address, &addr, sizeof addr, char ); - inet_ntop(af, &addr, str, INET6_ADDRSTRLEN); + inet_ntop(af, &addr, str, sizeof str); ST(0) = newSVpvn_flags(str, strlen(str), SVs_TEMP); #else @@ -494,9 +506,23 @@ inet_pton(af, host) CODE: #ifdef HAS_INETPTON int ok; - struct in6_addr ip_address; - if(af != AF_INET && af != AF_INET6) { - croak("Bad address family for %s, got %d, should be either AF_INET or AF_INET6", +#ifdef AF_INET6 + struct in6_addr ip_address; +#else + struct in_addr ip_address; +#endif + + if(af != AF_INET +#ifdef AF_INET6 + && af != AF_INET6 +#endif + ) { + croak("Bad address family for %s, got %d, should be" +#ifdef AF_INET6 + " either AF_INET or AF_INET6", +#else + " AF_INET", +#endif "Socket::inet_pton", af); } @@ -504,8 +530,7 @@ inet_pton(af, host) ST(0) = sv_newmortal(); if (ok) { - sv_setpvn( ST(0), (char *)&ip_address, - af == AF_INET6 ? sizeof(ip_address) : sizeof(struct in_addr) ); + sv_setpvn( ST(0), (char *)&ip_address, sizeof(ip_address) ); } #else ST(0) = (SV *)not_here("inet_pton"); -- Perl5 Master Repository