From 207023758269d4948064fc678252e8e2e67ed971 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 22 Feb 2023 17:57:58 -0600 Subject: [PATCH] Bugfix: Control group function is partially outdated and uses incorrect integer. The F_control_group_path_system_default_s_length should not be used here when progressing the path string. Use control_group.groups.array[i].used instead. --- level_1/fl_control_group/c/control_group.c | 4 ++-- level_2/fll_control_group/c/control_group.c | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/level_1/fl_control_group/c/control_group.c b/level_1/fl_control_group/c/control_group.c index e57c7ad..0002d69 100644 --- a/level_1/fl_control_group/c/control_group.c +++ b/level_1/fl_control_group/c/control_group.c @@ -29,7 +29,7 @@ extern "C" { if (!control_group.groups.array[i].used) continue; - path.used = control_group.path.used + control_group.groups.array[i].used + F_control_group_path_system_suffix_s_length; + path.used = control_group.path.used + control_group.groups.array[i].used + f_control_group_path_system_suffix_s.used; f_char_t path_string[path.used + 1]; path.string = path_string; @@ -39,7 +39,7 @@ extern "C" { } memcpy(path.string + control_group.path.used, control_group.groups.array[i].string, sizeof(f_char_t) * control_group.groups.array[i].used); - memcpy(path.string + control_group.path.used + F_control_group_path_system_default_s_length, F_control_group_path_system_suffix_s, sizeof(f_char_t) * F_control_group_path_system_suffix_s_length); + memcpy(path.string + control_group.path.used + control_group.groups.array[i].used, f_control_group_path_system_suffix_s.string, sizeof(f_char_t) * f_control_group_path_system_suffix_s.used); path.string[path.used] = 0; diff --git a/level_2/fll_control_group/c/control_group.c b/level_2/fll_control_group/c/control_group.c index e7b75ad..3e886f3 100644 --- a/level_2/fll_control_group/c/control_group.c +++ b/level_2/fll_control_group/c/control_group.c @@ -12,10 +12,7 @@ extern "C" { if (control_group.path.used) { status = f_directory_exists(control_group.path); if (F_status_is_error(status)) return status; - - if (status == F_false) { - return F_status_set_error(F_directory_not); - } + if (status == F_false) return F_status_set_error(F_directory_not); } f_string_static_t path = f_string_static_t_initialize; -- 1.8.3.1