diff options
author | Paul Green <Paul.Green@stratus.com> | 2010-10-03 14:18:17 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-03 14:18:17 -0700 |
commit | a5addb167c102dc5dcd1ab886caf0cb4f554eb05 (patch) | |
tree | 34357a69a8fd9bc026c232f75857fb86021f3a61 /ext/Socket | |
parent | 645d8892bdf2a7e5afe985dfd321b2d332930f62 (diff) | |
download | perl-a5addb167c102dc5dcd1ab886caf0cb4f554eb05.tar.gz |
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.
Diffstat (limited to 'ext/Socket')
-rw-r--r-- | ext/Socket/Socket.xs | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index af76554058..e2f995b660 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"); |