]> 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:59:01 +0000 (17:59 -0600)
committerKevin Day <kevin@kevux.org>
Thu, 23 Feb 2023 00:00:23 +0000 (18:00 -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 513f5a056b8fe1c5f7ee59e50eab76a1c5e928b7..07e1c33e408efe15763595b2661a9b05a57c7594 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;
 
@@ -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
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;