summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_snmp.c10
-rw-r--r--plugins/runcmd.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 2acada22..56a586ad 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) {
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);