From: Kevin Day Date: Fri, 1 Jul 2022 22:55:29 +0000 (-0500) Subject: Update: Add additional checks just in case execution is attempted with both program... X-Git-Tag: 0.5.10~2 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=6f7644dac2d8bfe9006054dd4c3a7c9ad79c75dc;p=fll Update: Add additional checks just in case execution is attempted with both program name and arguments have no data. --- diff --git a/level_3/fake/c/private-make-operate_process.c b/level_3/fake/c/private-make-operate_process.c index fcec4a2..4438f91 100644 --- a/level_3/fake/c/private-make-operate_process.c +++ b/level_3/fake/c/private-make-operate_process.c @@ -504,6 +504,10 @@ extern "C" { #ifndef _di_fake_make_operate_process_execute_ f_status_t fake_make_operate_process_execute(fake_make_data_t * const data_make, const f_string_static_t program, const f_string_statics_t arguments, const bool as_shell) { + if (!program.used && !arguments.used) { + return F_data_not; + } + if (fll_program_standard_signal_received(data_make->main)) { fake_print_signal_received(data_make->data); @@ -532,9 +536,18 @@ extern "C" { if (data_make->main->error.verbosity >= f_console_verbosity_verbose_e) { flockfile(data_make->main->output.to.stream); - f_print_dynamic_safely(program, data_make->main->output.to.stream); + f_array_length_t i = 0; - for (f_array_length_t i = 0; i < arguments.used; ++i) { + if (program.used) { + f_print_dynamic_safely(program, data_make->main->output.to.stream); + } + else { + i = 1; + + f_print_dynamic_safely(arguments.array[0], data_make->main->output.to.stream); + } + + for (; i < arguments.used; ++i) { if (arguments.array[i].used) { fll_print_format(" %Q", data_make->main->output.to.stream, arguments.array[i]); @@ -668,10 +681,11 @@ extern "C" { args.used = arguments.used - 1; args.size = 0; } + else if (!arguments.used) { + return F_data_not; + } - const f_status_t status = fake_make_operate_process_execute(data_make, arguments.array[0], args, as_shell); - - return status; + return fake_make_operate_process_execute(data_make, arguments.used ? arguments.array[0] : f_string_empty_s, args, as_shell); } #endif // _di_fake_make_operate_process_run_ diff --git a/level_3/fake/c/private-make-operate_process.h b/level_3/fake/c/private-make-operate_process.h index ee39783..131e1bd 100644 --- a/level_3/fake/c/private-make-operate_process.h +++ b/level_3/fake/c/private-make-operate_process.h @@ -57,6 +57,7 @@ extern "C" { * * @return * F_none on success. + * F_data_not if both program.used is 0 and arguments.used is 0. * * F_interrupt (with error bit) on receiving a terminate process signal, such as an interrupt signal. * @@ -106,7 +107,11 @@ extern "C" { * When FALSE, this is a run operation. * * @return - * Status codes (with error bit) are returned on any problem. + * F_data_not if arguments.used is 0. + * + * Success results from: fake_make_operate_process_execute(). + * + * Errors (with error bit) from: fake_make_operate_process_execute(). */ #ifndef _di_fake_make_operate_process_run_ extern f_status_t fake_make_operate_process_run(fake_make_data_t * const data_make, const f_string_statics_t arguments, const bool as_shell) F_attribute_visibility_internal_d;