CLEANUP: config: make parse_cpu_set() return documented values

parse_cpu_set() stopped returning the undocumented -1 which was a
leftover from an earlier attempt, changed from ulong to int since
it only returns a success/failure and no more a mask. Thus it must
not return -1 and its callers must only test for != 0, as is
documented.
This commit is contained in:
Willy Tarreau 2023-07-06 15:21:43 +02:00
parent f54d8c6457
commit 6ecabb3f35
2 changed files with 4 additions and 4 deletions

View File

@ -124,7 +124,7 @@ int too_many_args(int maxarg, char **args, char **msg, int *err_code);
int alertif_too_many_args_idx(int maxarg, int index, const char *file, int linenum, char **args, int *err_code);
int alertif_too_many_args(int maxarg, const char *file, int linenum, char **args, int *err_code);
int parse_process_number(const char *arg, unsigned long *proc, int max, int *autoinc, char **err);
unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char **err);
int parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char **err);
void free_email_alert(struct proxy *p);
const char *cfg_find_best_match(const char *word, const struct list *list, int section, const char **extra);
int warnifnotcap(struct proxy *proxy, int cap, const char *file, int line, const char *arg, const char *hint);

View File

@ -521,7 +521,7 @@ int parse_process_number(const char *arg, unsigned long *proc, int max, int *aut
* distinct argument in <args>. On success, it returns 0, otherwise it returns
* 1 with an error message in <err>.
*/
unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char **err)
int parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char **err)
{
int cur_arg = 0;
const char *arg;
@ -535,7 +535,7 @@ unsigned long parse_cpu_set(const char **args, struct hap_cpuset *cpu_set, char
if (!isdigit((unsigned char)*args[cur_arg])) {
memprintf(err, "'%s' is not a CPU range.", arg);
return -1;
return 1;
}
low = high = str2uic(arg);
@ -2645,7 +2645,7 @@ static int numa_detect_topology()
parse_cpu_set_args[0] = trash.area;
parse_cpu_set_args[1] = "\0";
if (parse_cpu_set(parse_cpu_set_args, &active_cpus, &err)) {
if (parse_cpu_set(parse_cpu_set_args, &active_cpus, &err) != 0) {
ha_notice("Cannot read online CPUs list: '%s'. Will not try to refine binding\n", err);
free(err);
goto free_scandir_entries;