diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 10 | ||||
-rw-r--r-- | plugins/runcmd.c | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 04dc6c6f..4d8e6406 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -158,6 +158,7 @@ int perf_labels = 1; | |||
158 | char* ip_version = ""; | 158 | char* ip_version = ""; |
159 | double multiplier = 1.0; | 159 | double multiplier = 1.0; |
160 | char *fmtstr = ""; | 160 | char *fmtstr = ""; |
161 | bool fmtstr_set = false; | ||
161 | char buffer[DEFAULT_BUFFER_SIZE]; | 162 | char buffer[DEFAULT_BUFFER_SIZE]; |
162 | 163 | ||
163 | static char *fix_snmp_range(char *th) | 164 | static char *fix_snmp_range(char *th) |
@@ -422,7 +423,8 @@ main (int argc, char **argv) | |||
422 | } | 423 | } |
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 | if (fmtstr != "") { | 426 | |
427 | if (fmtstr_set) { | ||
426 | conv = fmtstr; | 428 | conv = fmtstr; |
427 | } | 429 | } |
428 | } | 430 | } |
@@ -596,8 +598,9 @@ main (int argc, char **argv) | |||
596 | len = sizeof(perfstr)-strlen(perfstr)-1; | 598 | len = sizeof(perfstr)-strlen(perfstr)-1; |
597 | strncat(perfstr, show, len>ptr-show ? ptr-show : len); | 599 | strncat(perfstr, show, len>ptr-show ? ptr-show : len); |
598 | 600 | ||
599 | if (type) | 601 | if (strcmp(type, "") != 0) { |
600 | strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); | 602 | strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); |
603 | } | ||
601 | 604 | ||
602 | if (warning_thresholds) { | 605 | if (warning_thresholds) { |
603 | strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); | 606 | strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1); |
@@ -972,6 +975,7 @@ process_arguments (int argc, char **argv) | |||
972 | case 'f': | 975 | case 'f': |
973 | if (multiplier != 1.0) { | 976 | if (multiplier != 1.0) { |
974 | fmtstr=optarg; | 977 | fmtstr=optarg; |
978 | fmtstr_set = true; | ||
975 | } | 979 | } |
976 | break; | 980 | break; |
977 | } | 981 | } |
@@ -1186,7 +1190,7 @@ multiply (char *str) | |||
1186 | if(verbose>2) | 1190 | if(verbose>2) |
1187 | printf(" multiply extracted double: %f\n", val); | 1191 | printf(" multiply extracted double: %f\n", val); |
1188 | val *= multiplier; | 1192 | val *= multiplier; |
1189 | if (fmtstr != "") { | 1193 | if (fmtstr_set) { |
1190 | conv = fmtstr; | 1194 | conv = fmtstr; |
1191 | } | 1195 | } |
1192 | if (val == (int)val) { | 1196 | if (val == (int)val) { |
diff --git a/plugins/runcmd.c b/plugins/runcmd.c index c1d675d0..102191e4 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c | |||
@@ -116,10 +116,6 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | |||
116 | env[0] = strdup("LC_ALL=C"); | 116 | env[0] = strdup("LC_ALL=C"); |
117 | env[1] = '\0'; | 117 | env[1] = '\0'; |
118 | 118 | ||
119 | /* if no command was passed, return with no error */ | ||
120 | if (cmdstring == NULL) | ||
121 | return -1; | ||
122 | |||
123 | /* make copy of command string so strtok() doesn't silently modify it */ | 119 | /* make copy of command string so strtok() doesn't silently modify it */ |
124 | /* (the calling program may want to access it later) */ | 120 | /* (the calling program may want to access it later) */ |
125 | cmdlen = strlen(cmdstring); | 121 | cmdlen = strlen(cmdstring); |