[monitoring-plugins] Fixes for -Wunused

RincewindsHat git at monitoring-plugins.org
Mon May 8 20:30:15 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: 6c78f0b5ea82a4bea71ae2024f27d3916175a7a2
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Sun Mar 12 14:16:35 2023 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=6c78f0b

Fixes for -Wunused

* lib/utils_base.c
* plugins/check_curl.c
* plugins-root/check_dhcp.c
   Removed a line which theoretically can not do anything, but there was
   comment which indicated something else. Still trying this though.

---

 lib/utils_base.c          | 8 ++++----
 plugins-root/check_dhcp.c | 4 ----
 plugins/check_curl.c      | 5 ++---
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/lib/utils_base.c b/lib/utils_base.c
index eb1823b..c458cf6 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -24,7 +24,7 @@
 *
 *****************************************************************************/
 
-#include "common.h"
+#include "../plugins/common.h"
 #include <stdarg.h>
 #include "utils_base.h"
 #include <ctype.h>
@@ -319,18 +319,18 @@ char *np_extract_value(const char *varlist, const char *name, char sep) {
 
 	while (1) {
 		/* Strip any leading space */
-		for (varlist; isspace(varlist[0]); varlist++);
+		for (; isspace(varlist[0]); varlist++);
 
 		if (strncmp(name, varlist, strlen(name)) == 0) {
 			varlist += strlen(name);
 			/* strip trailing spaces */
-			for (varlist; isspace(varlist[0]); varlist++);
+			for (; isspace(varlist[0]); varlist++);
 
 			if (varlist[0] == '=') {
 				/* We matched the key, go past the = sign */
 				varlist++;
 				/* strip leading spaces */
-				for (varlist; isspace(varlist[0]); varlist++);
+				for (; isspace(varlist[0]); varlist++);
 
 				if (tmp = index(varlist, sep)) {
 					/* Value is delimited by a comma */
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index ad67323..147db6b 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -470,10 +470,6 @@ int send_dhcp_discover(int sock){
 	packet_xid=random();
 	discover_packet.xid=htonl(packet_xid);
 
-	/**** WHAT THE HECK IS UP WITH THIS?!?  IF I DON'T MAKE THIS CALL, ONLY ONE SERVER RESPONSE IS PROCESSED!!!! ****/
-	/* downright bizzarre... */
-	ntohl(discover_packet.xid);
-
 	/*discover_packet.secs=htons(65535);*/
 	discover_packet.secs=0xFF;
 
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index be5740d..100a97a 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -2217,11 +2217,10 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line)
   if( strchr( p, '.' ) != NULL ) {
 
     /* HTTP 1.x case */
-    char *ppp;
-    ppp = strtok( p, "." );
+    strtok( p, "." );
     status_line->http_major = (int)strtol( p, &pp, 10 );
     if( *pp != '\0' ) { free( first_line_buf ); return -1; }
-    ppp = strtok( NULL, " " );
+    strtok( NULL, " " );
     status_line->http_minor = (int)strtol( p, &pp, 10 );
     if( *pp != '\0' ) { free( first_line_buf ); return -1; }
     p += 4; /* 1.x SP */



More information about the Commits mailing list