summaryrefslogtreecommitdiff
path: root/lib/Net
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-12-15 15:11:15 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-12-15 15:11:15 +0000
commit95d3daf003b5912b1fa6b2ac441449564fa0d970 (patch)
treee92291204ae83dc9519a0ebf85536beec1968857 /lib/Net
parent2708b1f4ca0964d70333e73d846ad866747c9c0a (diff)
downloadperl-95d3daf003b5912b1fa6b2ac441449564fa0d970.tar.gz
More general fix for bug [perl #37915]
Make Net::Ping::mselect return undef on error instead of -1. p4raw-id: //depot/perl@26368
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/Ping.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Net/Ping.pm b/lib/Net/Ping.pm
index fee428c5ea..993b640c29 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;