Skip Menu |
 

This queue is for tickets about the Socket CPAN distribution.

Report information
The Basics
Id: 90217
Status: resolved
Priority: 0/
Queue: Socket

People
Owner: Nobody in particular
Requestors: fraserbn [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.014



Subject: Protect against getprotobyname() not being available
Download (untitled) / with headers
text/plain 996b
Since perl can be built without support for getprotobyname(), either because the system doesn't have the function (as with Android and possibly Blackberry 10) or they were undefined during Configure, Socket.pm should protect the calls to it with an eval {}. diff --git a/cpan/Socket/Socket.pm b/cpan/Socket/Socket.pm index 438f11a..167ade3 100644 --- a/cpan/Socket/Socket.pm +++ b/cpan/Socket/Socket.pm @@ -998,7 +998,7 @@ sub fake_getaddrinfo my @ports; # Actually ARRAYrefs of [ socktype, protocol, port ] my $protname = ""; if( $protocol ) { - $protname = getprotobynumber( $protocol ); + $protname = eval { getprotobynumber( $protocol ) }; } if( $service ne "" and $service !~ m/^\d+$/ ) { @@ -1029,7 +1029,7 @@ sub fake_getaddrinfo $port = 0; } - push @ports, [ $this_socktype, scalar getprotobyname( $this_protname ) || 0, $port ]; + push @ports, [ $this_socktype, eval { scalar getprotobyname( $this_protname ) } || 0, $port ]; } my @ret;
Thanks, patch applied. -- Paul Evans
Released in 2.014 -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.