From 7ff3c488f6e5c5f7384279daff0256b7ca988167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 17 Mar 2025 14:12:10 +0100 Subject: [PATCH] check_ide_smart: Fix positional arguments logic --- plugins/check_ide_smart.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 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; }