Subject: | Unreachable code path in MogileFS::Backend::_connect_sock |
I stumbled over these lines in the _connect_sock function of
MogileFS::Backend:
sub _connect_sock { # sock, sin, timeout
my ($sock, $sin, $timeout) = @_;
$timeout ||= 0.25;
# make the socket non-blocking for the connection if wanted, but
# unconditionally set it back to blocking mode at the end
if ($timeout) {
IO::Handle::blocking($sock, 0);
} else {
IO::Handle::blocking($sock, 1);
}
...
I think that the "else" block cannot be ever reached. If $timeout was
missing or undef or 0 in the _connect_sock call, then it's set to 0.25.
Otherwise $timeout is true, and the "if" block is always executed.
Probably setting the $timeout default should happen with //= instead, or
the pre-5.10.0 equivalent of this construct.
Regards,
Slaven