Skip to content

Commit

Permalink
override tmp file if non-integer char is insed or empty (fixes #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
scrat14 committed Oct 19, 2018
1 parent 0335bf1 commit 7b7015b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugin-dir/check_rhv.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1466,14 +1466,13 @@ sub check_nic_errors{
}
my $errors = `cat $cookie/$host/$nic`;
if ($errors !~ /^(\d)+$/){
print "Interface errors in file $cookie/$host/$nic not a number: $errors\n";
exit $ERRORS{$status{'unknown'}};
$errors = 0;
}
$return = $error - $errors;
# set counter to 0 if value is negative
# this can happen if counter is reseted on host (e.g. reboot)
$return = 0 if $return < 0;
write_errors_file($cookie . "/" . $host . "/" . $nic, $error);
write_errors_file($cookie . "/" . $host . "/" . $nic,$error);
}else{
$return = $error;
write_errors_file($cookie . "/" . $host . "/" . $nic, $error);
Expand Down

0 comments on commit 7b7015b

Please sign in to comment.