From 7ff3c488f6e5c5f7384279daff0256b7ca988167 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 17 Mar 2025 14:12:10 +0100 Subject: check_ide_smart: Fix positional arguments logic --- plugins/check_ide_smart.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index b13c7101..dd88e124 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c @@ -204,15 +204,17 @@ static check_ide_smart_config_wrapper process_arguments(int argc, char **argv) { default: usage5(); } - if (optind < argc) { - result.config.device = argv[optind]; - } + } - if (!result.config.device) { - print_help(); - exit(STATE_UNKNOWN); - } + if (optind < argc) { + result.config.device = argv[optind]; + } + + if (result.config.device == NULL) { + print_help(); + exit(STATE_UNKNOWN); } + return result; } -- cgit v1.2.3-74-g34f1