From: Kevin Day Date: Fri, 6 Jan 2023 03:57:27 +0000 (-0600) Subject: Bugfix: Support for passing a fakefile Section incorrectly fails. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=99696e1b2708ed74c57aa2154d85d54bea1298a3;p=fll Bugfix: Support for passing a fakefile Section incorrectly fails. The commit 6c05c66f50719c9edaa36dea75669e03cd558ee4 added a loop around the code. I forget to handle the return status and break out of the loop appropriately. Move the variable declaration outside of the loop to avoid re-declaring it inside. An error or a child signal should cause the loop to terminate. When the string comparison is matched, do not continue processing the inner loop. --- diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index 8a3c592..f80e96b 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -175,6 +175,8 @@ extern "C" { } } else { + int result = 0; + for (i = 0; i < data->main->parameters.remaining.used; ++i) { index = data->main->parameters.remaining.array[i]; @@ -185,30 +187,36 @@ extern "C" { if (fl_string_dynamic_partial_compare(data->main->parameters.arguments.array[index], data_make.buffer, range, data_make.fakefile.array[j].name) == F_equal_to) { { - const int result = fake_make_operate_section(&data_make, j, §ion_stack, &status); + int result = fake_make_operate_section(&data_make, j, §ion_stack, &status); if (status == F_child) { data->main->child = result; + + break; } } - if (status != F_child) { - const f_status_t status_path = f_path_change_at(data_make.path.top.id); + const f_status_t status_path = f_path_change_at(data_make.path.top.id); - if (F_status_is_error(status_path) && data->main->warning.verbosity >= f_console_verbosity_verbose_e) { - flockfile(data->main->warning.to.stream); + if (F_status_is_error(status_path) && data->main->warning.verbosity >= f_console_verbosity_verbose_e) { + flockfile(data->main->warning.to.stream); - fl_print_format("%r%[%QFailed change back to orignal path '%]", data->main->warning.to.stream, f_string_eol_s, data->main->warning.context, data->main->warning.prefix, data->main->warning.context); - fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, data_make.path.stack.array[0], data->main->warning.notable); - fl_print_format("%[', status code =%] ", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); - fl_print_format("%[%ui%]", data->main->warning.to.stream, data->main->warning.notable, F_status_set_fine(status_path), data->main->warning.notable); - fl_print_format("%['.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s); + fl_print_format("%r%[%QFailed change back to orignal path '%]", data->main->warning.to.stream, f_string_eol_s, data->main->warning.context, data->main->warning.prefix, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, data_make.path.stack.array[0], data->main->warning.notable); + fl_print_format("%[', status code =%] ", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); + fl_print_format("%[%ui%]", data->main->warning.to.stream, data->main->warning.notable, F_status_set_fine(status_path), data->main->warning.notable); + fl_print_format("%['.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s); - funlockfile(data->main->warning.to.stream); - } + funlockfile(data->main->warning.to.stream); } + + break; } + + if (F_status_is_error(status)) break; } // for + + if (status == F_child || F_status_is_error(status)) break; } // for } }