Update Socket to CPAN version 2.017
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Tue, 10 Feb 2015 16:12:31 +0000 (16:12 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Tue, 10 Feb 2015 16:12:31 +0000 (16:12 +0000)
  [DELTA]

2.017   2015/02/10 12:05:14
        [CHANGES]
         * Added some more SO_* constants defined on Linux (thanks
           Ronald van Dorp)

        [BUGFIXES]
         * Remember to SvGETMAGIC in getnameinfo() (RT79557)
         * Quiet some compiler warnings (RT101495, RT100736)
         * Fix "Attempt to free unreferenced scalar" warnings (RT78626, et.al.)

Porting/Maintainers.pl
cpan/Socket/Makefile.PL
cpan/Socket/Socket.pm
cpan/Socket/Socket.xs
cpan/Socket/t/getnameinfo.t

index 5c174df..1ca8b9d 100755 (executable)
@@ -989,7 +989,7 @@ use File::Glob qw(:case);
     },
 
     'Socket' => {
-        'DISTRIBUTION' => 'PEVANS/Socket-2.016.tar.gz',
+        'DISTRIBUTION' => 'PEVANS/Socket-2.017.tar.gz',
         'FILES'        => q[cpan/Socket],
     },
 
index aa105cd..46e063d 100644 (file)
@@ -210,14 +210,15 @@ my @names = (
 
        SOMAXCONN
 
-       SO_ACCEPTCONN SO_ATTACH_FILTER SO_BACKLOG SO_BROADCAST SO_CHAMELEON
-       SO_DEBUG SO_DETACH_FILTER SO_DGRAM_ERRIND SO_DOMAIN SO_DONTLINGER
-       SO_DONTROUTE SO_ERROR SO_FAMILY SO_KEEPALIVE SO_LINGER SO_OOBINLINE
-       SO_PASSCRED SO_PASSIFNAME SO_PEERCRED SO_PROTOCOL SO_PROTOTYPE
-       SO_RCVBUF SO_RCVLOWAT SO_RCVTIMEO SO_REUSEADDR SO_REUSEPORT
+       SO_ACCEPTCONN SO_ATTACH_FILTER SO_BACKLOG SO_BINDTODEVICE SO_BROADCAST
+       SO_BSDCOMPAT SO_BUSY_POLL SO_CHAMELEON SO_DEBUG SO_DETACH_FILTER
+       SO_DGRAM_ERRIND SO_DOMAIN SO_DONTLINGER SO_DONTROUTE SO_ERROR SO_FAMILY
+       SO_KEEPALIVE SO_LINGER SO_MARK SO_OOBINLINE SO_PASSCRED SO_PASSIFNAME
+       SO_PEEK_OFF SO_PEERCRED SO_PRIORITY SO_PROTOCOL SO_PROTOTYPE SO_RCVBUF
+       SO_RCVLOWAT SO_RCVTIMEO SO_REUSEADDR SO_REUSEPORT
        SO_SECURITY_AUTHENTICATION SO_SECURITY_ENCRYPTION_NETWORK
        SO_SECURITY_ENCRYPTION_TRANSPORT SO_SNDBUF SO_SNDLOWAT SO_SNDTIMEO
-       SO_STATE SO_TYPE SO_USELOOPBACK SO_XOPEN SO_XSE
+       SO_STATE SO_TIMESTAMP SO_TYPE SO_USELOOPBACK SO_XOPEN SO_XSE
 
        TCP_CONGESTION TCP_CONNECTIONTIMEOUT TCP_CORK TCP_DEFER_ACCEPT TCP_INFO
        TCP_INIT_CWND TCP_KEEPALIVE TCP_KEEPCNT TCP_KEEPIDLE TCP_KEEPINTVL
index 04d0e15..6a52bcf 100644 (file)
@@ -3,7 +3,7 @@ package Socket;
 use strict;
 { use 5.006001; }
 
-our $VERSION = '2.016';
+our $VERSION = '2.017';
 
 =head1 NAME
 
index 31571bf..702e4fa 100644 (file)
@@ -95,7 +95,7 @@ NETINET_DEFINE_CONTEXT
 #endif /* !Newx */
 
 #ifndef croak_sv
-# define croak_sv(sv)  croak(SvPV_nolen(sv))
+# define croak_sv(sv)  croak(SvPVx_nolen(sv))
 #endif
 
 #ifndef hv_stores
@@ -530,6 +530,7 @@ static void xs_getnameinfo(pTHX_ CV *cv)
        SP -= items;
 
        addr = ST(0);
+       SvGETMAGIC(addr);
 
        if(items < 2)
                flags = 0;
@@ -635,10 +636,10 @@ inet_ntoa(ip_address_sv)
         * so let's use this sprintf() workaround everywhere.
         * This is also more threadsafe than using inet_ntoa(). */
        ST(0) = sv_2mortal(Perl_newSVpvf(aTHX_ "%d.%d.%d.%d", /* IPv6? */
-                                        ((addr.s_addr >> 24) & 0xFF),
-                                        ((addr.s_addr >> 16) & 0xFF),
-                                        ((addr.s_addr >>  8) & 0xFF),
-                                        ( addr.s_addr        & 0xFF)));
+                                        (int)((addr.s_addr >> 24) & 0xFF),
+                                        (int)((addr.s_addr >> 16) & 0xFF),
+                                        (int)((addr.s_addr >>  8) & 0xFF),
+                                        (int)( addr.s_addr        & 0xFF)));
        }
 
 void
@@ -793,10 +794,10 @@ pack_sockaddr_in(port, ip_address_sv)
        ip_address = SvPVbyte(ip_address_sv, addrlen);
        if (addrlen == sizeof(addr) || addrlen == 4)
                addr.s_addr =
-                   (ip_address[0] & 0xFF) << 24 |
-                   (ip_address[1] & 0xFF) << 16 |
-                   (ip_address[2] & 0xFF) <<  8 |
-                   (ip_address[3] & 0xFF);
+                   (unsigned int)(ip_address[0] & 0xFF) << 24 |
+                   (unsigned int)(ip_address[1] & 0xFF) << 16 |
+                   (unsigned int)(ip_address[2] & 0xFF) <<  8 |
+                   (unsigned int)(ip_address[3] & 0xFF);
        else
                croak("Bad arg length for %s, length is %"UVuf", should be %"UVuf,
                      "Socket::pack_sockaddr_in",
@@ -876,6 +877,8 @@ pack_sockaddr_in6(port, sin6_addr, scope_id=0, flowinfo=0)
 #  endif
        ST(0) = sv_2mortal(newSVpvn((char *)&sin6, sizeof(sin6)));
 #else
+       PERL_UNUSED_VAR(port);
+       PERL_UNUSED_VAR(sin6_addr);
        ST(0) = (SV*)not_here("pack_sockaddr_in6");
 #endif
        }
@@ -914,6 +917,7 @@ unpack_sockaddr_in6(sin6_sv)
            mPUSHs(ip_address_sv);
        }
 #else
+       PERL_UNUSED_VAR(sin6_sv);
        ST(0) = (SV*)not_here("pack_sockaddr_in6");
 #endif
        }
@@ -973,6 +977,8 @@ inet_ntop(af, ip_address_sv)
 
        ST(0) = sv_2mortal(newSVpvn(str, strlen(str)));
 #else
+       PERL_UNUSED_VAR(af);
+       PERL_UNUSED_VAR(ip_address_sv);
        ST(0) = (SV*)not_here("inet_ntop");
 #endif
 
@@ -1015,6 +1021,8 @@ inet_pton(af, host)
                sv_setpvn( ST(0), (char *)&ip_address, addrlen);
        }
 #else
+       PERL_UNUSED_VAR(af);
+       PERL_UNUSED_VAR(host);
        ST(0) = (SV*)not_here("inet_pton");
 #endif
 
@@ -1116,6 +1124,8 @@ pack_ip_mreq_source(multiaddr, source, interface=&PL_sv_undef)
                mreq.imr_interface.s_addr = INADDR_ANY;
        ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
 #else
+       PERL_UNUSED_VAR(multiaddr);
+       PERL_UNUSED_VAR(source);
        not_here("pack_ip_mreq_source");
 #endif
        }
@@ -1138,6 +1148,7 @@ unpack_ip_mreq_source(mreq_sv)
        mPUSHp((char *)&mreq.imr_sourceaddr, sizeof(mreq.imr_sourceaddr));
        mPUSHp((char *)&mreq.imr_interface, sizeof(mreq.imr_interface));
 #else
+       PERL_UNUSED_VAR(mreq_sv);
        not_here("unpack_ip_mreq_source");
 #endif
        }
@@ -1163,6 +1174,8 @@ pack_ipv6_mreq(multiaddr, ifindex)
        mreq.ipv6mr_interface = ifindex;
        ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
 #else
+       PERL_UNUSED_VAR(multiaddr);
+       PERL_UNUSED_VAR(ifindex);
        not_here("pack_ipv6_mreq");
 #endif
        }
@@ -1184,6 +1197,7 @@ unpack_ipv6_mreq(mreq_sv)
        mPUSHp((char *)&mreq.ipv6mr_multiaddr, sizeof(mreq.ipv6mr_multiaddr));
        mPUSHi(mreq.ipv6mr_interface);
 #else
+       PERL_UNUSED_VAR(mreq_sv);
        not_here("unpack_ipv6_mreq");
 #endif
        }
index 1df639b..c5655bc 100644 (file)
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Test::More tests => 12;
+use Test::More tests => 13;
 
 use Socket qw(:addrinfo AF_INET pack_sockaddr_in inet_aton);
 
@@ -32,3 +32,8 @@ ok( length $host, '$host is nonzero length for NS' );
 cmp_ok( $err, "==", 0, '$err == 0 for {family=AF_INET,port=80,sinaddr=127.0.0.1}/NI_NUMERICHOST' );
 
 ok( length $service, '$service is nonzero length for NH' );
+
+# RT79557
+pack_sockaddr_in( 80, inet_aton( "127.0.0.1" ) ) =~ m/^(.*)$/s;
+( $err, $host, $service ) = getnameinfo( $1, NI_NUMERICHOST|NI_NUMERICSERV );
+cmp_ok( $err, "==", 0, '$err == 0 for $1' ) or diag( '$err was: ' . $err );