1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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.
This commit is contained in:
msvensson@pilot.mysql.com
2008-04-22 12:43:38 +02:00
parent fdf1376aec
commit 23f462137e

View File

@ -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 # native_path
@ -105,27 +96,27 @@ sub check_socket_path_length {
my ($path)= @_; my ($path)= @_;
my $truncated= 0; my $truncated= 0;
if (HAVE_UNIX_SOCKET){ require IO::Socket::UNIX;
require IO::Socket::UNIX;
my $sock = new IO::Socket::UNIX my $sock = new IO::Socket::UNIX
( (
Local => $path, Local => $path,
Listen => 1, Listen => 1,
) or die $!; );
if ($path ne $sock->hostpath()){ if (!defined $sock){
# Path was truncated # Could not create a UNIX domain socket
$truncated= 1; return 0; # Ok, will not be used by mysqld either
# Output diagnostic messages }
print "path: '$path', length: ", length($path) ,"\n"; if ($path ne $sock->hostpath()){
print "hostpath: '", $sock->hostpath(), # Path was truncated
"', length: ", length($sock->hostpath()), "\n"; $truncated= 1;
} # Output diagnostic messages
$sock= undef; print "path: '$path', length: ", length($path) ,"\n";
unlink($path); print "hostpath: '", $sock->hostpath(),
return $truncated; "', length: ", length($sock->hostpath()), "\n";
}; }
# All paths OK! $sock= undef; # Close socket
unlink($path); # Remove the physical file
return $truncated; return $truncated;
} }