Module: monitoring-plugins
 Branch: master
 Commit: 7ff3c488f6e5c5f7384279daff0256b7ca988167
 Author: Lorenz Kästle <[email protected]>
   Date: Mon Mar 17 14:12:10 2025 +0100
    URL: 
https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=7ff3c488

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;
 }
 

Reply via email to