summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-09-19 09:06:39 (GMT)
committerGitHub <noreply@github.com>2023-09-19 09:06:39 (GMT)
commit220455a11e8f1dd3a86ac4725cf0c799c8e3b21b (patch)
treefffe9429dbf796841a1d2699d49c921f3bf369d1 /plugins/check_snmp.c
parent2f0119ef1d4c009f1ed7fc10f5a6a1e0b224c3d2 (diff)
parentfe239bf1c458f62499f3cdaf66d9d48957375a73 (diff)
downloadmonitoring-plugins-220455a11e8f1dd3a86ac4725cf0c799c8e3b21b.tar.gz
Merge pull request #1870 from RincewindsHat/compiler_warning_part_5
Compiler warning part 5
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 2acada2..56a586a 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -159,6 +159,7 @@ int perf_labels = 1;
159char* ip_version = ""; 159char* ip_version = "";
160double multiplier = 1.0; 160double multiplier = 1.0;
161char *fmtstr = ""; 161char *fmtstr = "";
162bool fmtstr_set = false;
162char buffer[DEFAULT_BUFFER_SIZE]; 163char buffer[DEFAULT_BUFFER_SIZE];
163bool ignore_mib_parsing_errors = false; 164bool ignore_mib_parsing_errors = false;
164 165
@@ -437,7 +438,8 @@ main (int argc, char **argv)
437 } 438 }
438 else if (strstr (response, "INTEGER: ")) { 439 else if (strstr (response, "INTEGER: ")) {
439 show = multiply (strstr (response, "INTEGER: ") + 9); 440 show = multiply (strstr (response, "INTEGER: ") + 9);
440 if (fmtstr != "") { 441
442 if (fmtstr_set) {
441 conv = fmtstr; 443 conv = fmtstr;
442 } 444 }
443 } 445 }
@@ -611,8 +613,9 @@ main (int argc, char **argv)
611 len = sizeof(perfstr)-strlen(perfstr)-1; 613 len = sizeof(perfstr)-strlen(perfstr)-1;
612 strncat(perfstr, show, len>ptr-show ? ptr-show : len); 614 strncat(perfstr, show, len>ptr-show ? ptr-show : len);
613 615
614 if (type) 616 if (strcmp(type, "") != 0) {
615 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); 617 strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
618 }
616 619
617 if (warning_thresholds) { 620 if (warning_thresholds) {
618 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); 621 strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
@@ -988,6 +991,7 @@ process_arguments (int argc, char **argv)
988 case 'f': 991 case 'f':
989 if (multiplier != 1.0) { 992 if (multiplier != 1.0) {
990 fmtstr=optarg; 993 fmtstr=optarg;
994 fmtstr_set = true;
991 } 995 }
992 break; 996 break;
993 case L_IGNORE_MIB_PARSING_ERRORS: 997 case L_IGNORE_MIB_PARSING_ERRORS:
@@ -1204,7 +1208,7 @@ multiply (char *str)
1204 if(verbose>2) 1208 if(verbose>2)
1205 printf(" multiply extracted double: %f\n", val); 1209 printf(" multiply extracted double: %f\n", val);
1206 val *= multiplier; 1210 val *= multiplier;
1207 if (fmtstr != "") { 1211 if (fmtstr_set) {
1208 conv = fmtstr; 1212 conv = fmtstr;
1209 } 1213 }
1210 if (val == (int)val) { 1214 if (val == (int)val) {