In perl.git, the branch maint-5.12 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/6b6803ca5cc042a20bd63333defdcf9b4b5a045c?hp=4ffae9cec64e9dd4150c249b8d63bdceb4e65fb2>

- Log -----------------------------------------------------------------
commit 6b6803ca5cc042a20bd63333defdcf9b4b5a045c
Author: Paul Green <[email protected]>
Date:   Thu Dec 2 10:34:00 2010 -0500

    Fix perl build problems on Stratus VOS
    
    This patch is a port of commit a5addb167c102dc5dcd1ab886caf0cb4f554eb05 to
    the 5.12 maintenance branch.  It removes the extra "miniperl" dependency
    of the "all" target in Makefile.SH, and also tweaks ext/Socket/Socket.xs
    to build on systems that do not have the relevant IPv6 defines.
-----------------------------------------------------------------------

Summary of changes:
 Makefile.SH          |    2 +-
 ext/Socket/Socket.xs |   50 ++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/Makefile.SH b/Makefile.SH
index bff2f59..c429e1e 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -553,7 +553,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 2d469ed..f96ccd3 100644
--- a/ext/Socket/Socket.xs
+++ b/ext/Socket/Socket.xs
@@ -465,21 +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 Socket::inet_ntop, 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
@@ -493,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);
         }
@@ -503,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

Reply via email to