[monitoring-plugins] check_curl: Parse state-regex option ignoring case

RincewindsHat git at monitoring-plugins.org
Sun Oct 6 23:30:12 CEST 2024


 Module: monitoring-plugins
 Branch: master
 Commit: b6c72064a53da8b173b7406a0a535922dc0cc1b3
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Mon Aug 19 15:26:52 2024 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=b6c7206

check_curl: Parse state-regex option ignoring case

Previously the --state-regex option accepted only "critical" and
"warning" as values.
This commit changes the strcmp there to strcasecmp to be more tolerant
regarding the input.

---

 plugins/check_curl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index bf46b22..38c9710 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1775,9 +1775,9 @@ process_arguments (int argc, char **argv)
       invert_regex = true;
       break;
     case STATE_REGEX:
-      if (!strcmp (optarg, "critical"))
+      if (!strcasecmp (optarg, "critical"))
         state_regex = STATE_CRITICAL;
-      else if (!strcmp (optarg, "warning"))
+      else if (!strcasecmp (optarg, "warning"))
         state_regex = STATE_WARNING;
       else usage2 (_("Invalid state-regex option"), optarg);
       break;



More information about the Commits mailing list