diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-08 08:07:37 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-08 08:07:37 +0000 |
commit | 4f45392acb8e67e86b92b3707eba49ef9aeee574 (patch) | |
tree | 4ed9fe09faf2b3b9720b9438695ac4a50079c61e /plugins | |
parent | b39ae71c60f0039cda60590715fc17f92107ac35 (diff) | |
download | monitoring-plugins-4f45392acb8e67e86b92b3707eba49ef9aeee574.tar.gz |
user reports NULL still getting into asprintf
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@176 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 12 |
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); |