--timeout-result use case-insensitive comparison for result states

This commit is contained in:
Ahmet Oeztuerk 2026-05-12 14:35:47 +02:00
parent 9d9bc68b6a
commit df9ba1829a
2 changed files with 8 additions and 8 deletions

View file

@ -1016,13 +1016,13 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
}
break;
case TIMEOUT_RESULT:
if (!strcmp(optarg, "0") || !strcmp(optarg, "ok")) {
if (!strcmp(optarg, "0") || !strcasecmp(optarg, "ok")) {
result.config.on_timeout_result_state = STATE_OK;
} else if (!strcmp(optarg, "1") || !strcmp(optarg, "warning")) {
} else if (!strcmp(optarg, "1") || !strcasecmp(optarg, "warning")) {
result.config.on_timeout_result_state = STATE_WARNING;
} else if (!strcmp(optarg, "2") || !strcmp(optarg, "critical")) {
} else if (!strcmp(optarg, "2") || !strcasecmp(optarg, "critical")) {
result.config.on_timeout_result_state = STATE_CRITICAL;
} else if (!strcmp(optarg, "3") || !strcmp(optarg, "unknown")) {
} else if (!strcmp(optarg, "3") || !strcasecmp(optarg, "unknown")) {
result.config.on_timeout_result_state = STATE_UNKNOWN;
} else {
usage2(_("Invalid timeout-result state option, give either a return code or state "

View file

@ -301,13 +301,13 @@ bool process_arguments(int argc, char **argv) {
}
break;
case TIMEOUT_RESULT:
if (!strcmp(optarg, "0") || !strcmp(optarg, "ok")) {
if (!strcmp(optarg, "0") || !strcasecmp(optarg, "ok")) {
socket_timeout_state = STATE_OK;
} else if (!strcmp(optarg, "1") || !strcmp(optarg, "warning")) {
} else if (!strcmp(optarg, "1") || !strcasecmp(optarg, "warning")) {
socket_timeout_state = STATE_WARNING;
} else if (!strcmp(optarg, "2") || !strcmp(optarg, "critical")) {
} else if (!strcmp(optarg, "2") || !strcasecmp(optarg, "critical")) {
socket_timeout_state = STATE_CRITICAL;
} else if (!strcmp(optarg, "3") || !strcmp(optarg, "unknown")) {
} else if (!strcmp(optarg, "3") || !strcasecmp(optarg, "unknown")) {
socket_timeout_state = STATE_UNKNOWN;
} else {
usage2(_("Invalid timeout-result state option, give either a return code or state "