From 71d87d1a1c3e77e046cd1a8069ab688b9054ce9b Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 9 Feb 2021 23:13:07 -0600 Subject: [PATCH] Cleanup: don't re-use 'result' variable name, and fix documentation. --- level_2/fll_execute/c/execute.h | 4 ++-- level_2/fll_execute/c/private-execute.c | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index 7b9c300..e958a9c 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -487,11 +487,11 @@ extern "C" { * @see f_file_exists() * @see f_limit_process() * @see f_signal_mask() + * @see f_string_append() + * @see f_string_dynamic_terminate() * @see f_thread_signal_mask() * @see fl_control_group_apply() * @see fl_environment_path_explode_dynamic() - * @see f_string_append() - * @see f_string_dynamic_terminate() */ #ifndef _di_fll_execute_program_ extern f_status_t fll_execute_program(const f_string_t program, const f_string_statics_t arguments, fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, int *result); diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 3bf527d..05c36d3 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -287,18 +287,16 @@ extern "C" { const f_file_t file = f_macro_file_t_initialize2(0, descriptors[1], f_file_flag_write_only); - f_string_static_t result = f_string_static_t_initialize; + f_string_static_t buffer = f_string_static_t_initialize; - result.string = string_result; - result.used = 1; - result.size = 2; + buffer.string = string_result; + buffer.used = 1; + buffer.size = 2; const f_status_t status = private_fll_execute_as_parent(*as, id_process, parameter, string_result); // inform the child that it can now safely begin (or exit). - if (F_status_is_error(f_file_write(file, result, 0))) { - string_result[0] = '1'; - } + f_file_write(file, buffer, 0); // close the write pipe for the parent when finished writing. close(descriptors[1]); @@ -451,16 +449,16 @@ extern "C" { // have the parent perform all appropriate access controls and then send either '0' for no error or '1' for error to the child. if (as) { - f_string_static_t result = f_string_static_t_initialize; + f_string_static_t buffer = f_string_static_t_initialize; - result.string = string_result; - result.used = 1; - result.size = 2; + buffer.string = string_result; + buffer.used = 1; + buffer.size = 2; status = private_fll_execute_as_parent(*as, id_process, parameter, string_result); // inform the child that it can now safely begin (or exit). - if (F_status_is_error(f_file_write(file, result, 0))) { + if (F_status_is_error(f_file_write(file, buffer, 0))) { string_result[0] = '1'; } } -- 1.8.3.1