From: Kevin Day Date: Wed, 22 Feb 2023 23:59:01 +0000 (-0600) Subject: Bugfix: Control group function is partially outdated and uses incorrect integer. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=a60ff10df04284b930cbfcd43c896b2bc9960129;p=fll 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. --- diff --git a/level_1/fl_control_group/c/control_group.c b/level_1/fl_control_group/c/control_group.c index 513f5a0..07e1c33 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; @@ -49,6 +49,7 @@ extern "C" { fprintf(file.stream, "%d", id); f_file_stream_flush(file); + status = f_file_stream_close(&file); if (F_status_is_error(status)) break; } // for 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;