[monitoring-plugins] Fixes for Waddress

RincewindsHat git at monitoring-plugins.org
Tue Sep 19 11:10:12 CEST 2023


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

Fixes for Waddress

* check_snmp: Fix string comparison

---

 plugins/check_snmp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index c425df3..425bb7b 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -422,7 +422,8 @@ main (int argc, char **argv)
 		}
 		else if (strstr (response, "INTEGER: ")) {
 			show = multiply (strstr (response, "INTEGER: ") + 9);
-			if (fmtstr != "") {
+
+			if (strcmp(fmtstr, "") != 0) {
 				conv = fmtstr;
 			}
 		}
@@ -596,8 +597,9 @@ main (int argc, char **argv)
 			len = sizeof(perfstr)-strlen(perfstr)-1;
 			strncat(perfstr, show, len>ptr-show ? ptr-show : len);
 
-			if (type)
+			if (strcmp(type, "") != 0) {
 				strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
+			}
 
 			if (warning_thresholds) {
 				strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
@@ -1185,7 +1187,7 @@ multiply (char *str)
 	if(verbose>2)
 		printf("    multiply extracted double: %f\n", val);
 	val *= multiplier;
-	if (fmtstr != "") {
+	if (strcmp(fmtstr, "") != 0) {
 		conv = fmtstr;
 	}
 	if (val == (int)val) {



More information about the Commits mailing list