sysSentry/setting-parameters-must-be-integer.patch

39 lines
1.6 KiB
Diff
Raw Normal View History

2024-08-30 15:15:07 +08:00
From 4abad77067557234d938de3914094c80181030c1 Mon Sep 17 00:00:00 2001
From: jwolf <523083921@qq.com>
Date: Fri, 30 Aug 2024 14:30:46 +0800
Subject: [PATCH] must be integer
---
c/catcli/catlib/cli_param_checker.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/c/catcli/catlib/cli_param_checker.c b/src/c/catcli/catlib/cli_param_checker.c
index e400428..5b38402 100644
--- a/src/c/catcli/catlib/cli_param_checker.c
+++ b/src/c/catcli/catlib/cli_param_checker.c
@@ -17,8 +17,9 @@ void checkset_cpu_usage_percentage(char *getopt_optarg, catcli_request_body *p_r
if (cpu_utility <= 0 || cpu_utility > CPU_USAGE_PERCENTAGE_MAX || strchr(getopt_optarg, '.') != NULL) {
strncpy(errs->patrol_module_err,
"\"cpu_utility \" must be an integer greater in the range (0,100],correct \"-u, --cpu_utility\"\n", MAX_ERR_LEN);
+ } else {
+ p_request_body->cpu_utility = (int)cpu_utility;
}
- p_request_body->cpu_utility = (int)cpu_utility;
}
void checkset_cpulist(char *getopt_optarg, catcli_request_body *p_request_body, struct option_errs *errs)
@@ -73,8 +74,9 @@ void checkset_patrol_time(char *getopt_optarg, catcli_request_body *p_request_bo
strncpy(errs->patrol_time_err,
"\"patrol_second\" must be a number in the range of (0,INT_MAX] ,correct \"-t, --patrol_second\"\n",
MAX_ERR_LEN);
+ } else {
+ p_request_body->patrol_second = (int)second;
}
- p_request_body->patrol_second = (int)second;
}
void checkset_patrol_type(char *getopt_optarg, catcli_request_body *p_request_body, struct option_errs *errs)
--
2.27.0