summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 425bb7b2..135bbc7c 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -158,6 +158,7 @@ int perf_labels = 1;
158char* ip_version = ""; 158char* ip_version = "";
159double multiplier = 1.0; 159double multiplier = 1.0;
160char *fmtstr = ""; 160char *fmtstr = "";
161bool fmtstr_set = false;
161char buffer[DEFAULT_BUFFER_SIZE]; 162char buffer[DEFAULT_BUFFER_SIZE];
162 163
163static char *fix_snmp_range(char *th) 164static char *fix_snmp_range(char *th)
@@ -423,7 +424,7 @@ main (int argc, char **argv)
423 else if (strstr (response, "INTEGER: ")) { 424 else if (strstr (response, "INTEGER: ")) {
424 show = multiply (strstr (response, "INTEGER: ") + 9); 425 show = multiply (strstr (response, "INTEGER: ") + 9);
425 426
426 if (strcmp(fmtstr, "") != 0) { 427 if (fmtstr_set) {
427 conv = fmtstr; 428 conv = fmtstr;
428 } 429 }
429 } 430 }
@@ -973,6 +974,7 @@ process_arguments (int argc, char **argv)
973 case 'f': 974 case 'f':
974 if (multiplier != 1.0) { 975 if (multiplier != 1.0) {
975 fmtstr=optarg; 976 fmtstr=optarg;
977 fmtstr_set = true;
976 } 978 }
977 break; 979 break;
978 } 980 }
@@ -1187,7 +1189,7 @@ multiply (char *str)
1187 if(verbose>2) 1189 if(verbose>2)
1188 printf(" multiply extracted double: %f\n", val); 1190 printf(" multiply extracted double: %f\n", val);
1189 val *= multiplier; 1191 val *= multiplier;
1190 if (strcmp(fmtstr, "") != 0) { 1192 if (fmtstr_set) {
1191 conv = fmtstr; 1193 conv = fmtstr;
1192 } 1194 }
1193 if (val == (int)val) { 1195 if (val == (int)val) {