Skip to content

Commit 0bae195

Browse files
committed
simplify the ipv6 check
1 parent 70dcb46 commit 0bae195

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

mysql-test/suite.pm

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,10 @@ sub skip_combinations {
5656
sub ipv6_ok() {
5757
use Socket;
5858
return 0 unless socket my $sock, PF_INET6, SOCK_STREAM, getprotobyname('tcp');
59-
my $ipv6_works = false;
59+
$!="";
6060
# eval{}, if there's no Socket::sockaddr_in6 at all, old Perl installation <5.14
61-
eval {
62-
my $addr = sockaddr_in6($baseport, Socket::IN6ADDR_LOOPBACK) or return 0;
63-
die 'bind failed' unless bind $sock, $addr;
64-
close $sock;
65-
$ipv6_works = true;
66-
};
67-
return $@ eq "" && $ipv6_works;
61+
eval { bind $sock, sockaddr_in6($::baseport, Socket::IN6ADDR_LOOPBACK) };
62+
return $@ eq "" && $! eq ""
6863
}
6964
$skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok();
7065

0 commit comments

Comments
 (0)