From: Rafael Garcia-Suarez Date: Thu, 15 Dec 2005 15:11:15 +0000 (+0000) Subject: More general fix for bug [perl #37915] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=95d3daf003b5912b1fa6b2ac441449564fa0d970;p=p5sagit%2Fp5-mst-13.2.git More general fix for bug [perl #37915] Make Net::Ping::mselect return undef on error instead of -1. p4raw-id: //depot/perl@26368 --- diff --git a/lib/Net/Ping.pm b/lib/Net/Ping.pm index fee428c..993b640 100644 --- a/lib/Net/Ping.pm +++ b/lib/Net/Ping.pm @@ -240,6 +240,7 @@ sub mselect while (1) { $gran = $t if $gran > $t; my $nfound = select($_[0], $_[1], $_[2], $gran); + undef $nfound if $nfound == -1; $t -= $gran; return $nfound if $nfound or !defined($nfound) or $t <= 0; @@ -248,7 +249,9 @@ sub mselect } } else { - return select($_[0], $_[1], $_[2], $_[3]); + my $nfound = select($_[0], $_[1], $_[2], $_[3]); + undef $nfound if $nfound == -1; + return $nfound; } } @@ -454,7 +457,7 @@ sub ping_icmp { $nfound = mselect((my $rout=$rbits), undef, undef, $timeout); # Wait for packet $timeout = $finish_time - &time(); # Get remaining time - if ($nfound == -1) # Hmm, a strange error + if (!defined($nfound)) # Hmm, a strange error { $ret = undef; $done = 1;