diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-06-23 11:44:46 +0200 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-06-23 11:44:46 +0200 |
commit | 8626d22fc5df98d73b36eedb01cb4ed02908ea18 (patch) | |
tree | 1a986e39b5ed2bb482d0898ce1fc532c0555c13e | |
parent | 6ac0580a10e5dcbda79ac8959a3b52f5217e877e (diff) | |
download | monitoring-plugins-8626d22fc5df98d73b36eedb01cb4ed02908ea18.tar.gz |
check_icmp: trigger help before anything important
-rw-r--r-- | plugins-root/check_icmp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 8feeb853..03924a7e 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -353,6 +353,7 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) { | |||
353 | long int arg; | 353 | long int arg; |
354 | while ((arg = getopt_long(argc, argv, opts_str, longopts, NULL)) != EOF) { | 354 | while ((arg = getopt_long(argc, argv, opts_str, longopts, NULL)) != EOF) { |
355 | switch (arg) { | 355 | switch (arg) { |
356 | |||
356 | case '4': | 357 | case '4': |
357 | if (enforced_ai_family != AF_UNSPEC) { | 358 | if (enforced_ai_family != AF_UNSPEC) { |
358 | crash("Multiple protocol versions not supported"); | 359 | crash("Multiple protocol versions not supported"); |
@@ -369,6 +370,11 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) { | |||
369 | result.config.number_of_hosts++; | 370 | result.config.number_of_hosts++; |
370 | break; | 371 | break; |
371 | } | 372 | } |
373 | case 'h': /* help */ | ||
374 | // Trigger help here to avoid adding hosts before that (and doing DNS queries) | ||
375 | print_help(); | ||
376 | exit(STATE_UNKNOWN); | ||
377 | break; | ||
372 | case 'v': | 378 | case 'v': |
373 | debug++; | 379 | debug++; |
374 | break; | 380 | break; |
@@ -490,10 +496,6 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) { | |||
490 | case 'V': /* version */ | 496 | case 'V': /* version */ |
491 | print_revision(progname, NP_VERSION); | 497 | print_revision(progname, NP_VERSION); |
492 | exit(STATE_UNKNOWN); | 498 | exit(STATE_UNKNOWN); |
493 | case 'h': /* help */ | ||
494 | print_help(); | ||
495 | exit(STATE_UNKNOWN); | ||
496 | break; | ||
497 | case 'R': /* RTA mode */ { | 499 | case 'R': /* RTA mode */ { |
498 | get_threshold2_wrapper rta_th = get_threshold2( | 500 | get_threshold2_wrapper rta_th = get_threshold2( |
499 | optarg, strlen(optarg), result.config.warn, result.config.crit, const_rta_mode); | 501 | optarg, strlen(optarg), result.config.warn, result.config.crit, const_rta_mode); |