The return code also stores signal information.
To properly return the expected return code, WEXITSTATUS() should be used.
In some cases a return code of "0" is always returned, even on error.
In these cases, now return "1" if an error is detected.
Use "return_code" more consistently, it is more explicit than "result" or "results".
f_macro_string_dynamics_t_delete_simple(arguments);
}
else {
- int result = 0;
+ int return_code = 0;
// child processes should receive all signals, without blocking.
f_signal_how_t signals = f_signal_how_t_initialize;
f_signal_set_empty(&signals.block);
f_signal_set_fill(&signals.block_not);
- *status = fll_execute_path_environment(path.string, arguments, &signals, data_build.environment.names, data_build.environment.values, &result);
+ *status = fll_execute_path_environment(path.string, arguments, &signals, data_build.environment.names, data_build.environment.values, &return_code);
f_macro_string_dynamics_t_delete_simple(arguments);
if (F_status_is_error(*status)) {
fake_print_message(data, F_status_set_fine(*status), "fake_execute", F_true, data_make->print);
}
- else {
- fake_make_operate_process_return(data, return_code, data_make, status);
- }
+
+ fake_make_operate_process_return(data, return_code, data_make, status);
return;
}
return;
}
- fake_make_operate_process_return(data, 0, data_make, status);
+ if (F_status_is_error(*status)) {
+ fake_make_operate_process_return(data, 1, data_make, status);
+ }
+ else {
+ fake_make_operate_process_return(data, 0, data_make, status);
+ }
+
return;
}
return;
}
- fake_make_operate_process_return(data, 0, data_make, status);
+ if (F_status_is_error(*status)) {
+ fake_make_operate_process_return(data, 1, data_make, status);
+ }
+ else {
+ fake_make_operate_process_return(data, 0, data_make, status);
+ }
+
return;
}
if (F_status_is_error(*status)) {
fake_print_message(data, F_status_set_fine(*status), "fake_execute", F_true, data_make->print);
}
- else {
- fake_make_operate_process_return(data, return_code, data_make, status);
- }
+
+ fake_make_operate_process_return(data, return_code, data_make, status);
return;
}
return;
}
- fake_make_operate_process_return(data, 0, data_make, status);
+ if (F_status_is_error(*status)) {
+ fake_make_operate_process_return(data, 1, data_make, status);
+ }
+ else {
+ fake_make_operate_process_return(data, 0, data_make, status);
+ }
+
return;
}
fflush(f_type_output);
}
- int result = 0;
+ int return_code = 0;
// child processes should receive all signals, without blocking.
f_signal_how_t signals = f_signal_how_t_initialize;
f_signal_set_fill(&signals.block_not);
if (as_shell) {
- status = fll_execute_path_environment(program.string, arguments, &signals, data_make->environment.names, data_make->environment.values, &result);
+ status = fll_execute_path_environment(program.string, arguments, &signals, data_make->environment.names, data_make->environment.values, &return_code);
}
else {
- status = fll_execute_program_environment(program.string, arguments, &signals, data_make->environment.names, data_make->environment.values, &result);
+ status = fll_execute_program_environment(program.string, arguments, &signals, data_make->environment.names, data_make->environment.values, &return_code);
}
if (status == F_status_set_error(F_signal)) {
}
}
- fake_make_operate_process_return(data, result, data_make, &status);
+ fake_make_operate_process_return(data, return_code, data_make, &status);
return status;
}
if (return_code) {
f_string_dynamic_t number = f_string_dynamic_t_initialize;
- status2 = f_conversion_number_signed_to_string(return_code, 10, &number);
+ status2 = f_conversion_number_signed_to_string(WEXITSTATUS(return_code), 10, &number);
if (F_status_is_error(status2)) {
*status = status2;
bool show_ports = F_true;
f_string_dynamics_t parameters = f_string_dynamics_t_initialize;
- int results = 0;
+ int return_code = 0;
if (data->remaining.used > 0) {
show_nat = F_false;
parameters.array[4].used = 9;
parameters.array[5].used = 6;
- status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, &results);
+ status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, &return_code);
fprintf(f_type_output, "\n");
fflush(f_type_output);
parameters.array[4].used = 9;
parameters.array[5].used = 6;
- status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, &results);
+ status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, &return_code);
fprintf(f_type_output, "\n");
fflush(f_type_output);
parameters.array[2].used = 9;
parameters.array[3].used = 6;
- status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, &results);
+ status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, &return_code);
fprintf(f_type_output, "\n");
fflush(f_type_output);
f_string_dynamics_t arguments = f_string_dynamics_t_initialize;
f_string_dynamic_t argument = f_string_dynamic_t_initialize;
- int results = 0;
+ int return_code = 0;
f_string_length_t length = 0;
bool invalid = F_false;
bool is_ip_list = F_false;
}
#endif // _en_firewall_debug_
- status = fll_execute_program((f_string_t) current_tool, arguments, 0, &results);
+ status = fll_execute_program((f_string_t) current_tool, arguments, 0, &return_code);
if (status == F_failure) {
fl_color_print_line(f_type_error, data.context.error, data.context.reset, "ERROR: Failed to perform requested %s operation:", current_tool);
}
#endif // _en_firewall_debug_
- status = fll_execute_program(current_tool, arguments, 0, &results);
+ status = fll_execute_program(current_tool, arguments, 0, &return_code);
if (status == F_failure) {
fl_color_print_line(f_type_error, data.context.error, data.context.reset, "ERROR: Failed to perform requested %s operation:", current_tool);
uint8_t tool = firewall_program_iptables;
bool new_chain = F_false;
bool create_chain = F_false;
- int results = 0;
+ int return_code = 0;
f_array_length_t i = 0;
f_array_length_t j = 0;
#endif // _en_firewall_debug_
tool = firewall_program_iptables;
- status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, &results);
+ status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, &return_code);
if (F_status_is_error_not(status)) {
// print command when debugging.
#endif // _en_firewall_debug_
tool = firewall_program_ip6tables;
- status = fll_execute_program((f_string_t) firewall_tool_ip6tables, arguments, 0, &results);
+ status = fll_execute_program((f_string_t) firewall_tool_ip6tables, arguments, 0, &return_code);
}
if (F_status_is_error(status)) {
for (f_string_length_t i = 0; i < 2; i++) {
f_string_dynamics_t arguments = f_string_dynamics_t_initialize;
f_string_dynamic_t argument[1] = f_string_dynamic_t_initialize;
- int results = 0;
+ int return_code = 0;
argument[0].string = (f_string_t) "-F";
argument[0].size = 2;
}
#endif // _en_firewall_debug_
- status = fll_execute_program(tools[i], arguments, 0, &results);
+ status = fll_execute_program(tools[i], arguments, 0, &return_code);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
for (f_string_length_t i = 0; i < 2; i++) {
f_string_dynamics_t arguments = f_string_dynamics_t_initialize;
f_string_dynamic_t argument[1] = f_string_dynamic_t_initialize;
- int results = 0;
+ int return_code = 0;
argument[0].string = (f_string_t) firewall_chain_delete_command;
argument[0].size = firewall_chain_delete_command_length;
}
#endif // _en_firewall_debug_
- status = fll_execute_program(tools[i], arguments, 0, &results);
+ status = fll_execute_program(tools[i], arguments, 0, &return_code);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
arguments.array[2].size = arguments.array[2].used;
for (f_string_length_t j = 0; j < 2; j++) {
- int results = 0;
+ int return_code = 0;
// print command when debugging.
#ifdef _en_firewall_debug_
}
#endif // _en_firewall_debug_
- status = fll_execute_program(tools[j], arguments, 0, &results);
+ status = fll_execute_program(tools[j], arguments, 0, &return_code);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);