summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_snmp.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 4a51a294..de019bac 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -415,9 +415,6 @@ process_arguments (int argc, char **argv)
415 strcpy (argv[c], "-c"); 415 strcpy (argv[c], "-c");
416 } 416 }
417 417
418 /* initialize some args */
419 asprintf (&oid, "");
420
421 while (1) { 418 while (1) {
422#ifdef HAVE_GETOPT_H 419#ifdef HAVE_GETOPT_H
423 c = 420 c =
@@ -453,7 +450,7 @@ process_arguments (int argc, char **argv)
453 ptr[0] = ' '; /* relpace comma with space */ 450 ptr[0] = ' '; /* relpace comma with space */
454 for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) 451 for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++)
455 eval_method[++j] |= WARN_PRESENT; 452 eval_method[++j] |= WARN_PRESENT;
456 asprintf (&oid, "%s %s", oid, optarg); 453 asprintf (&oid, "%s %s", (oid?oid:""), optarg);
457 break; 454 break;
458 case 'E': /* PRELIMINARY - may change */ 455 case 'E': /* PRELIMINARY - may change */
459 eval_method[j] |= WARN_PRESENT; 456 eval_method[j] |= WARN_PRESENT;
@@ -461,7 +458,7 @@ process_arguments (int argc, char **argv)
461 ptr[0] = ' '; /* relpace comma with space */ 458 ptr[0] = ' '; /* relpace comma with space */
462 for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) 459 for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++)
463 eval_method[++j] |= CRIT_PRESENT; 460 eval_method[++j] |= CRIT_PRESENT;
464 asprintf (&oid, "%s %s", oid, optarg); 461 asprintf (&oid, "%s %s", (oid?oid:""), optarg);
465 break; 462 break;
466 case 'c': /* critical time threshold */ 463 case 'c': /* critical time threshold */
467 if (strspn (optarg, "0123456789:,") < strlen (optarg)) { 464 if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
@@ -500,10 +497,9 @@ process_arguments (int argc, char **argv)
500 case 'o': /* object identifier */ 497 case 'o': /* object identifier */
501 for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) 498 for (ptr = optarg; (ptr = index (ptr, ',')); ptr++)
502 ptr[0] = ' '; /* relpace comma with space */ 499 ptr[0] = ' '; /* relpace comma with space */
503 for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) { 500 for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++)
504 j++; /* count OIDs */ 501 j++; /* count OIDs */
505 } 502 asprintf (&oid, "%s %s", (oid?oid:""), optarg);
506 asprintf (&oid, "%s %s", oid, optarg);
507 break; 503 break;
508 case 'd': /* delimiter */ 504 case 'd': /* delimiter */
509 delimiter = strscpy (delimiter, optarg); 505 delimiter = strscpy (delimiter, optarg);