Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #198 from dotdoom/master-ping_unintialized_value_fix
Fixing a warning in the ping plugin
  • Loading branch information
Flameeyes committed Sep 27, 2012
2 parents 4699dea + d112f62 commit d573ab0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/network/ping/ping
Expand Up @@ -171,8 +171,10 @@ for (my $host_i = 0; $host_i < @host_addrs; ++$host_i) {
my @ping = `$h_ping $ping_args $h_addr $ping_args2`;
chomp @ping;
my $ping = join(" ", @ping);
my $ping_time = ($1 / 1000) if ($ping =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
my $packet_loss = $1 if ($ping =~ /(\d+)% packet loss/);
my $ping_time = "U";
my $packet_loss = "U";
$ping_time = ($1 / 1000) if ($ping =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
$packet_loss = $1 if ($ping =~ /(\d+)% packet loss/);
print "$h_norm_name.value ". ($packetloss_mode ? $packet_loss : $ping_time) . "\n";
if ($pid == 0) {
# this is a child process, don't forget to exit
Expand Down

0 comments on commit d573ab0

Please sign in to comment.