[monitoring-plugins] Check ntp remove unused variables (#1781)

GitHub git at monitoring-plugins.org
Wed Sep 14 11:00:11 CEST 2022


    Module: monitoring-plugins
    Branch: master
    Commit: b89aee56964f7d933f2da5f371e32b4d7db9410b
    Author: Lorenz <12514511+RincewindsHat at users.noreply.github.com>
 Committer: GitHub <noreply at github.com>
      Date: Wed Sep 14 10:54:46 2022 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=b89aee5

Check ntp remove unused variables (#1781)

* Remove unused argument

* Fix typo in comment

---

 plugins/check_ntp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 914b40c..8b776ba 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -355,7 +355,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
  * - we also "manually" handle resolving host names and connecting, because
  *   we have to do it in a way that our lazy macros don't handle currently :( */
 double offset_request(const char *host, int *status){
-	int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
+	int i=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
 	int servers_completed=0, one_read=0, servers_readable=0, best_index=-1;
 	time_t now_time=0, start_ts=0;
 	ntp_message *req=NULL;
@@ -488,7 +488,7 @@ double offset_request(const char *host, int *status){
 	/* cleanup */
 	/* FIXME: Not closing the socket to avoid re-use of the local port
 	 * which can cause old NTP packets to be read instead of NTP control
-	 * pactets in jitter_request(). THERE MUST BE ANOTHER WAY...
+	 * packets in jitter_request(). THERE MUST BE ANOTHER WAY...
 	 * for(j=0; j<num_hosts; j++){ close(socklist[j]); } */
 	free(socklist);
 	free(ufds);
@@ -512,7 +512,7 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){
 }
 
 /* XXX handle responses with the error bit set */
-double jitter_request(const char *host, int *status){
+double jitter_request(int *status){
 	int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0;
 	int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0;
 	int peers_size=0, peer_offset=0;
@@ -803,7 +803,7 @@ int main(int argc, char *argv[]){
 	 * (for example) will result in an error
 	 */
 	if(do_jitter){
-		jitter=jitter_request(server_address, &jitter_result);
+		jitter=jitter_request(&jitter_result);
 		result = max_state_alt(result, get_status(jitter, jitter_thresholds));
 		/* -1 indicates that we couldn't calculate the jitter
 		 * Only overrides STATE_OK from the offset */



More information about the Commits mailing list