This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #39178] IO::Socket::connect returns wrong errno on timeout
[perl5.git] / ext / IO / lib / IO / Socket.pm
index fe887d4..5d78322 100644 (file)
@@ -117,6 +117,7 @@ sub connect {
 
            my $sel = new IO::Select $sock;
 
 
            my $sel = new IO::Select $sock;
 
+           undef $!;
            if (!$sel->can_write($timeout)) {
                $err = $! || (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
                $@ = "connect: timeout";
            if (!$sel->can_write($timeout)) {
                $err = $! || (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
                $@ = "connect: timeout";