New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad select error handling in Net::Ping #8245
Comments
From alexander_bluhm@genua.deCreated by alexander_bluhm@genua.deIf the select() system call fails, the following error handling in This little program causes select() to fail by returning from a #!/usr/bin/perl And here is the output: There are two Bugs in Net::Ping::ping_icmp that cause this strange 454 $nfound = mselect((my $rout=$rbits), undef, undef, $timeout); # Wait for packet The author of Net::Ping thought that if select() fails, it returns $ perl -e'$SIG{INT}=sub {}; print select(undef,undef,undef,undef), $!, "\n"' After pressing Ctrl-C it is obvious, that select() returns -1, not undef So with correct error checking Net::Ping::ping_icmp looks like this: Inline Patch--- /usr/libdata/perl5/Net/Ping.pm Mon Apr 4 22:25:33 2005
+++ Net/Ping.pm Tue Dec 13 18:36:04 2005
@@ -453,7 +453,7 @@
{
$nfound = mselect((my $rout=$rbits), undef, undef, $timeout); # Wait for packet
$timeout = $finish_time - &time(); # Get remaining time
- if (!defined($nfound)) # Hmm, a strange error
+ if ($nfound == -1) # Hmm, a strange error
{
$ret = undef;
$done = 1;
With the patched Net::Ping the test program terminates after the The second bug is that the return value of recv() in line 466 is So I think there are three things to be done: 1. Fix the select error handling in Net::Ping. Fixing only 1. helps to avoid the problem I ran into. Perl Info
|
From @rgsalexander_bluhm@genua.de (via RT) wrote:
Thanks, I've applied your patch as change #26367 in the development |
The RT System itself - Status changed from 'new' to 'open' |
From @rgsRafael Garcia-Suarez wrote:
More generally, I've reverted this with #26368, choosing the more |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#37915 (status was 'resolved')
Searchable as RT37915$
The text was updated successfully, but these errors were encountered: