Since IO::Socket::UNIX is part of core perl, it's not enough to

"eval use" it. Instead trap the error that occurs when creating the socket
on platforms that does not support it. 
parent fdf1376a
......@@ -51,15 +51,6 @@ BEGIN {
}
}
BEGIN {
if (eval "use IO::Socket::UNIX; 1") {
eval 'sub HAVE_UNIX_SOCKET { 1 }';
}
else {
eval 'sub HAVE_UNIX_SOCKET { 0 }';
}
}
#
# native_path
......@@ -105,14 +96,17 @@ sub check_socket_path_length {
my ($path)= @_;
my $truncated= 0;
if (HAVE_UNIX_SOCKET){
require IO::Socket::UNIX;
my $sock = new IO::Socket::UNIX
(
Local => $path,
Listen => 1,
) or die $!;
);
if (!defined $sock){
# Could not create a UNIX domain socket
return 0; # Ok, will not be used by mysqld either
}
if ($path ne $sock->hostpath()){
# Path was truncated
$truncated= 1;
......@@ -121,11 +115,8 @@ sub check_socket_path_length {
print "hostpath: '", $sock->hostpath(),
"', length: ", length($sock->hostpath()), "\n";
}
$sock= undef;
unlink($path);
return $truncated;
};
# All paths OK!
$sock= undef; # Close socket
unlink($path); # Remove the physical file
return $truncated;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment