From 6d341c40ab4d84d5eabfd672de1ffa3c7ecd07be Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 12 Mar 2023 14:04:25 +0100 Subject: Fixes for Waddress * check_snmp: Fix string comparison 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) { -- cgit v0.10-9-g596f