]> Kevux Git Server - fll/commitdiff
Bugfix: Control group function is partially outdated and uses incorrect integer.
authorKevin Day <kevin@kevux.org>
Wed, 22 Feb 2023 23:57:58 +0000 (17:57 -0600)
committerKevin Day <kevin@kevux.org>
Wed, 22 Feb 2023 23:57:58 +0000 (17:57 -0600)
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
level_2/fll_control_group/c/control_group.c

index e57c7ad44d2b03ba51e7d6d4355d7ab32e8a04b6..0002d69b82da6846450c04399f659fd15401afa0 100644 (file)
@@ -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;
 
index e7b75adcd5f6b6599bc2ac58a70ad0dc9e01dd41..3e886f3c321f65f514c39c3a89f191ec5b9b169c 100644 (file)
@@ -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;