diff options
| author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-03-12 14:04:25 +0100 |
|---|---|---|
| committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-04-18 00:35:41 +0200 |
| commit | 6d341c40ab4d84d5eabfd672de1ffa3c7ecd07be (patch) | |
| tree | abb9e0cf5d539024ecfdfb28c6e7f83b96d7ad7b | |
| parent | a00c412e7ba1474b32f478daf039d2bdf71f072a (diff) | |
| download | monitoring-plugins-6d341c40ab4d84d5eabfd672de1ffa3c7ecd07be.tar.gz | |
Fixes for Waddress
* check_snmp: Fix string comparison
| -rw-r--r-- | plugins/check_snmp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index c425df3c..425bb7b2 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -422,7 +422,8 @@ main (int argc, char **argv) | |||
| 422 | } | 422 | } |
| 423 | else if (strstr (response, "INTEGER: ")) { | 423 | else if (strstr (response, "INTEGER: ")) { |
| 424 | show = multiply (strstr (response, "INTEGER: ") + 9); | 424 | show = multiply (strstr (response, "INTEGER: ") + 9); |
| 425 | if (fmtstr != "") { | 425 | |
| 426 | if (strcmp(fmtstr, "") != 0) { | ||
| 426 | conv = fmtstr; | 427 | conv = fmtstr; |
| 427 | } | 428 | } |
| 428 | } | 429 | } |
| @@ -596,8 +597,9 @@ main (int argc, char **argv) | |||
| 596 | len = sizeof(perfstr)-strlen(perfstr)-1; | 597 | len = sizeof(perfstr)-strlen(perfstr)-1; |
| 597 | strncat(perfstr, show, len>ptr-show ? ptr-show : len); | 598 | strncat(perfstr, show, len>ptr-show ? ptr-show : len); |
| 598 | 599 | ||
| 599 | if (type) | 600 | if (strcmp(type, "") != 0) { |
| 600 | strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); | 601 | strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); |
| 602 | } | ||
| 601 | 603 | ||
| 602 | if (warning_thresholds) { | 604 | if (warning_thresholds) { |
| 603 | strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); | 605 | strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); |
| @@ -1185,7 +1187,7 @@ multiply (char *str) | |||
| 1185 | if(verbose>2) | 1187 | if(verbose>2) |
| 1186 | printf(" multiply extracted double: %f\n", val); | 1188 | printf(" multiply extracted double: %f\n", val); |
| 1187 | val *= multiplier; | 1189 | val *= multiplier; |
| 1188 | if (fmtstr != "") { | 1190 | if (strcmp(fmtstr, "") != 0) { |
| 1189 | conv = fmtstr; | 1191 | conv = fmtstr; |
| 1190 | } | 1192 | } |
| 1191 | if (val == (int)val) { | 1193 | if (val == (int)val) { |
