mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-02-20 00:10:09 -05:00
Detect if fmtstr was set in edge cases
This commit is contained in:
parent
4f4dd3a7a3
commit
068c124f36
1 changed files with 4 additions and 2 deletions
|
|
@ -158,6 +158,7 @@ int perf_labels = 1;
|
|||
char* ip_version = "";
|
||||
double multiplier = 1.0;
|
||||
char *fmtstr = "";
|
||||
bool fmtstr_set = false;
|
||||
char buffer[DEFAULT_BUFFER_SIZE];
|
||||
|
||||
static char *fix_snmp_range(char *th)
|
||||
|
|
@ -423,7 +424,7 @@ main (int argc, char **argv)
|
|||
else if (strstr (response, "INTEGER: ")) {
|
||||
show = multiply (strstr (response, "INTEGER: ") + 9);
|
||||
|
||||
if (strcmp(fmtstr, "") != 0) {
|
||||
if (fmtstr_set) {
|
||||
conv = fmtstr;
|
||||
}
|
||||
}
|
||||
|
|
@ -973,6 +974,7 @@ process_arguments (int argc, char **argv)
|
|||
case 'f':
|
||||
if (multiplier != 1.0) {
|
||||
fmtstr=optarg;
|
||||
fmtstr_set = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1187,7 +1189,7 @@ multiply (char *str)
|
|||
if(verbose>2)
|
||||
printf(" multiply extracted double: %f\n", val);
|
||||
val *= multiplier;
|
||||
if (strcmp(fmtstr, "") != 0) {
|
||||
if (fmtstr_set) {
|
||||
conv = fmtstr;
|
||||
}
|
||||
if (val == (int)val) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue