diff options
author | Sven Nierlein <sven@nierlein.de> | 2014-07-31 11:28:30 +0200 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.de> | 2014-07-31 11:28:30 +0200 |
commit | df08974bf07bae1ea5dcbec68bad4cdfce52aeff (patch) | |
tree | c911495fa2df719ac549a3db766644aa7a9cdf6f /plugins | |
parent | a3dcdb87236d5746ca002e9ede7699849b7c6779 (diff) | |
download | monitoring-plugins-df08974bf07bae1ea5dcbec68bad4cdfce52aeff.tar.gz |
check_ntp_peer: do not use uninitialized results for max state
s/t/jresult are not initialized if there is no corresponding threshold
supplied. So we shouldn't use them for calculating our result.
Signed-off-by: Sven Nierlein <sven@nierlein.de>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ntp_peer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index d3ae5999..44424af5 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c | |||
@@ -599,17 +599,20 @@ int main(int argc, char *argv[]){ | |||
599 | } | 599 | } |
600 | oresult = result; | 600 | oresult = result; |
601 | 601 | ||
602 | if(do_truechimers) | 602 | if(do_truechimers) { |
603 | tresult = get_status(num_truechimers, truechimer_thresholds); | 603 | tresult = get_status(num_truechimers, truechimer_thresholds); |
604 | result = max_state_alt(result, tresult); | 604 | result = max_state_alt(result, tresult); |
605 | } | ||
605 | 606 | ||
606 | if(do_stratum) | 607 | if(do_stratum) { |
607 | sresult = get_status(stratum, stratum_thresholds); | 608 | sresult = get_status(stratum, stratum_thresholds); |
608 | result = max_state_alt(result, sresult); | 609 | result = max_state_alt(result, sresult); |
610 | } | ||
609 | 611 | ||
610 | if(do_jitter) | 612 | if(do_jitter) { |
611 | jresult = get_status(jitter, jitter_thresholds); | 613 | jresult = get_status(jitter, jitter_thresholds); |
612 | result = max_state_alt(result, jresult); | 614 | result = max_state_alt(result, jresult); |
615 | } | ||
613 | 616 | ||
614 | switch (result) { | 617 | switch (result) { |
615 | case STATE_CRITICAL : | 618 | case STATE_CRITICAL : |