From 79e8e7157a92f404ab4259a53c8af302d925f4e2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 11 Feb 2021 21:47:36 -0600 Subject: [PATCH] Update: memory function tweaks, update thread code, and improve execute functions. Restructure the memory functions a little. Add comments about realloc() potentially changing the pointer address. A few of the thread type macros are missing semicolons. Remove f_macro_thread_mutex_t_clear(). There are likely other thread types that cannot be set to 0, and they will be correct as I discover them. Rename the thread condition block and unblock functions. Add missing f_thread_detach() implementation. The execute fnctio fll_execute_program() should use pid_t when returning a PID. This is potentially different from int, so instead use a void * and cast to an int * or pid_t * as necessary. --- level_0/f_memory/c/memory.h | 4 +++ level_0/f_memory/c/private-memory.c | 64 ++++++++++++++++----------------- level_0/f_thread/c/thread-common.h | 26 +++++++------- level_0/f_thread/c/thread.c | 28 +++++++++++---- level_0/f_thread/c/thread.h | 22 ++++++------ level_2/fll_execute/c/execute.c | 2 +- level_2/fll_execute/c/execute.h | 5 +-- level_2/fll_execute/c/private-execute.c | 34 ++++++++++-------- level_2/fll_execute/c/private-execute.h | 6 ++-- level_3/fake/c/private-build.c | 2 +- level_3/fake/c/private-fake.c | 2 +- level_3/fake/c/private-make.c | 2 +- level_3/firewall/c/firewall.c | 6 ++-- level_3/firewall/c/private-firewall.c | 14 ++++---- 14 files changed, 123 insertions(+), 94 deletions(-) diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index aa62ae4..87751da 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -36,6 +36,8 @@ extern "C" { * * Will change all data to 0 prior to deallocation. * + * The pointer address might be changed by realloc(). + * * @param old_length * The total number of blocks representing the length to be resized from. * @param new_length @@ -173,6 +175,8 @@ extern "C" { * * Will not change any of the data prior to deallocation. * + * The pointer address might be changed by realloc(). + * * @param old_length * The total number of blocks representing the length to be resized from. * @param new_length diff --git a/level_0/f_memory/c/private-memory.c b/level_0/f_memory/c/private-memory.c index 98e193e..271021a 100644 --- a/level_0/f_memory/c/private-memory.c +++ b/level_0/f_memory/c/private-memory.c @@ -13,8 +13,6 @@ extern "C" { } if (*pointer) { - void *new_pointer = 0; - if (length_old) { if (length_new < length_old) { @@ -25,26 +23,28 @@ extern "C" { } if (length_new) { - new_pointer = realloc(*pointer, type_size * length_new); - } - else { - free(*pointer); + void *new_pointer = realloc(*pointer, type_size * length_new); - // assure that the pointer is always 0 after deallocation. - *pointer = 0; + if (new_pointer) { + if (length_new > length_old) { - return F_none; - } + // uint8_t * is of a data size size of 1, casting it to bool should result in a single-length increment. + // this is done to avoid problems with (void *) having arithmetic issues. + memset(((uint8_t *) new_pointer) + (type_size * length_old), 0, type_size * (length_new - length_old)); + } - if (new_pointer) { - if (length_new > length_old) { + if (pointer != new_pointer) { + *pointer = new_pointer; + } - // uint8_t * is of a data size size of 1, casting it to bool should result in a single-length increment. - // this is done to avoid problems with (void *) having arithmetic issues. - memset(((uint8_t *) new_pointer) + (type_size * length_old), 0, type_size * (length_new - length_old)); + return F_none; } + } + else { + free(*pointer); - *pointer = new_pointer; + // assure that the pointer is always 0 after deallocation. + *pointer = 0; return F_none; } @@ -74,29 +74,29 @@ extern "C" { } if (*pointer) { - void *new_pointer = 0; - if (length_new) { - new_pointer = realloc(*pointer, type_size * length_new); - } - else { - free(*pointer); + void *new_pointer = realloc(*pointer, type_size * length_new); - // assure that the pointer is always 0 after deallocation. - *pointer = 0; + if (new_pointer) { + if (length_new > length_old) { - return F_none; - } + // uint8_t * is of a data size size of 1, casting it to bool should result in a single-length increment. + // this is done to avoid problems with (void *) having arithmetic issues. + memset(((uint8_t *) new_pointer) + (type_size * length_old), 0, type_size * (length_new - length_old)); + } - if (new_pointer) { - if (length_new > length_old) { + if (pointer != new_pointer) { + *pointer = new_pointer; + } - // uint8_t * is of a data size size of 1, casting it to bool should result in a single-length increment. - // this is done to avoid problems with (void *) having arithmetic issues. - memset(((uint8_t *) new_pointer) + (type_size * length_old), 0, type_size * (length_new - length_old)); + return F_none; } + } + else { + free(*pointer); - *pointer = new_pointer; + // assure that the pointer is always 0 after deallocation. + *pointer = 0; return F_none; } diff --git a/level_0/f_thread/c/thread-common.h b/level_0/f_thread/c/thread-common.h index 68d5160..38ddb14 100644 --- a/level_0/f_thread/c/thread-common.h +++ b/level_0/f_thread/c/thread-common.h @@ -25,7 +25,7 @@ extern "C" { #define f_thread_attribute_t_initialize { 0 } // This does not clear the thread.attributes.__size array (may need to memset() against a sizeof(pthread_attr_t)). - #define f_macro_thread_attribute_t_clear(attribute) attribute.__align = 0 + #define f_macro_thread_attribute_t_clear(attribute) attribute.__align = 0; #define f_macro_thread_attribute_t_delete_simple(attribute) f_thread_attribute_delete(&attribute); #endif // _di_f_thread_attribute_t_ @@ -69,7 +69,7 @@ extern "C" { #define f_thread_barrier_t_initialize { 0 } - #define f_macro_thread_barrier_t_clear(barrier) barrier = 0 + #define f_macro_thread_barrier_t_clear(barrier) barrier = 0; #define f_macro_thread_barrier_t_delete_simple(barrier) f_thread_barrier_delete(&barrier); #endif // _di_f_thread_barrier_t_ @@ -113,7 +113,7 @@ extern "C" { #define f_thread_barrier_attribute_t_initialize { 0 } - #define f_macro_thread_barrier_attribute_t_clear(barrier_attribute) barrier_attribute = 0 + #define f_macro_thread_barrier_attribute_t_clear(barrier_attribute) barrier_attribute = 0; #define f_macro_thread_barrier_attribute_t_delete_simple(barrier_attribute) f_thread_barrier_attribute_delete(&barrier_attribute); #endif // _di_f_thread_barrier_attribute_t_ @@ -157,7 +157,7 @@ extern "C" { #define f_thread_condition_t_initialize PTHREAD_COND_INITIALIZER; - #define f_macro_thread_condition_t_clear(condition) condition = 0 + #define f_macro_thread_condition_t_clear(condition) condition = 0; #define f_macro_thread_condition_t_delete_simple(condition) f_thread_condition_delete(&condition); #endif // _di_f_thread_condition_t_ @@ -201,7 +201,7 @@ extern "C" { #define f_thread_condition_attribute_t_initialize 0; - #define f_macro_thread_condition_attribute_t_clear(attribute) attribute = 0 + #define f_macro_thread_condition_attribute_t_clear(attribute) attribute = 0; #define f_macro_thread_condition_attribute_t_delete_simple(attribute) f_thread_condition_attribute_delete(&attribute); #endif // _di_f_thread_condition_attribute_t_ @@ -285,7 +285,7 @@ extern "C" { #define f_thread_key_t_initialize 0 - #define f_macro_thread_key_t_clear(key) key = 0 + #define f_macro_thread_key_t_clear(key) key = 0; #define f_macro_thread_key_t_delete_simple(key) f_thread_key_delete(&key); #endif // _di_f_thread_key_t_ @@ -329,7 +329,7 @@ extern "C" { #define f_thread_lock_t_initialize 0 - #define f_macro_thread_lock_t_clear(lock) lock = 0 + #define f_macro_thread_lock_t_clear(lock) lock = 0; #endif // _di_f_thread_lock_t_ /** @@ -369,7 +369,7 @@ extern "C" { #define f_thread_lock_attribute_t_initialize 0 - #define f_macro_thread_lock_attribute_t_clear(attribute) attribute = 0 + #define f_macro_thread_lock_attribute_t_clear(attribute) attribute = 0; #endif // _di_f_thread_lock_attribute_t_ /** @@ -405,14 +405,14 @@ extern "C" { /** * A typedef representing pthread_mutex_t. + * + * This variable cannot be cleared by setting value to 0, so there is no clear macro provided. */ #ifndef _di_f_thread_mutex_t_ typedef pthread_mutex_t f_thread_mutex_t; #define f_thread_mutex_t_initialize PTHREAD_MUTEX_INITIALIZER - #define f_macro_thread_mutex_t_clear(mutex) mutex = 0 - #define f_macro_thread_mutex_t_delete_simple(mutex) f_thread_mutex_delete(&mutex); #endif // _di_f_thread_mutex_t_ @@ -455,7 +455,7 @@ extern "C" { #define f_thread_mutex_attribute_t_initialize 0 - #define f_macro_thread_mutex_attribute_t_clear(mutex_attribute) mutex_attribute = 0 + #define f_macro_thread_mutex_attribute_t_clear(mutex_attribute) mutex_attribute = 0; #endif // _di_f_thread_mutex_attribute_t_ /** @@ -497,7 +497,7 @@ extern "C" { #define f_thread_once_t_initialize 0 - #define f_macro_thread_once_t_clear(once) once = 0 + #define f_macro_thread_once_t_clear(once) once = 0; #endif // _di_f_thread_once_t_ /** @@ -591,7 +591,7 @@ extern "C" { #define f_thread_spin_t_initialize PTHREAD_MUTEX_INITIALIZER - #define f_macro_thread_spin_t_clear(spin) spin = 0 + #define f_macro_thread_spin_t_clear(spin) spin = 0; #define f_macro_thread_spin_t_delete_simple(spin) f_thread_spin_delete(&spin); #endif // _di_f_thread_spin_t_ diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 7a43f65..6b3af45 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1126,8 +1126,8 @@ extern "C" { } #endif // _di_f_thread_condition_delete_ -#ifndef _di_f_thread_condition_unblock_all_ - f_status_t f_thread_condition_unblock_all(f_thread_condition_t *condition) { +#ifndef _di_f_thread_condition_signal_all_ + f_status_t f_thread_condition_signal_all(f_thread_condition_t *condition) { #ifndef _di_level_0_parameter_checking_ if (!condition) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1142,10 +1142,10 @@ extern "C" { return F_none; } -#endif // _di_f_thread_condition_unblock_all_ +#endif // _di_f_thread_condition_signal_all_ -#ifndef _di_f_thread_condition_unblock_any_ - f_status_t f_thread_condition_unblock_any(f_thread_condition_t *condition) { +#ifndef _di_f_thread_condition_signal_ + f_status_t f_thread_condition_signal(f_thread_condition_t *condition) { #ifndef _di_level_0_parameter_checking_ if (!condition) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -1160,7 +1160,7 @@ extern "C" { return F_none; } -#endif // _di_f_thread_condition_unblock_any_ +#endif // _di_f_thread_condition_signal_ #ifndef _di_f_thread_condition_wait_ f_status_t f_thread_condition_wait(f_thread_condition_t *condition, f_thread_mutex_t *mutex) { @@ -1316,6 +1316,22 @@ extern "C" { } #endif // _di_f_thread_create_ +#ifndef _di_f_thread_detach_ + f_status_t f_thread_detach(const f_thread_id_t id) { + + const int error = pthread_detach(id); + + if (error) { + if (error == EINVAL) return F_status_set_error(F_parameter); + if (error == ESRCH) return F_status_set_error(F_found_not); + + return F_status_set_error(F_failure); + } + + return F_none; + } +#endif // _di_f_thread_detach_ + #ifndef _di_f_thread_exit_ f_status_t f_thread_exit(int *result) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index 51239a1..ebacc31 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -1487,7 +1487,7 @@ extern "C" { #endif // _di_f_thread_condition_delete_ /** - * Unblock all threads waiting on a condition. + * Signal all threads waiting on a condition. * * @param condition * The condition to broadcast the unblock signal to. @@ -1500,12 +1500,14 @@ extern "C" { * * @see pthread_cond_broadcast() */ -#ifndef _di_f_thread_condition_unblock_all_ - extern f_status_t f_thread_condition_unblock_all(f_thread_condition_t *condition); -#endif // _di_f_thread_condition_unblock_all_ +#ifndef _di_f_thread_condition_signal_all_ + extern f_status_t f_thread_condition_signal_all(f_thread_condition_t *condition); +#endif // _di_f_thread_condition_signal_all_ /** - * Unblock all threads waiting on a condition. + * Signal a thread waiting on a condition. + * + * Only a single thread waiting on this condition is signaled. * * @param condition * The condition to broadcast the unblock signal to. @@ -1518,9 +1520,9 @@ extern "C" { * * @see pthread_cond_signal() */ -#ifndef _di_f_thread_condition_unblock_any_ - extern f_status_t f_thread_condition_unblock_any(f_thread_condition_t *condition); -#endif // _di_f_thread_condition_unblock_any_ +#ifndef _di_f_thread_condition_signal_ + extern f_status_t f_thread_condition_signal(f_thread_condition_t *condition); +#endif // _di_f_thread_condition_signal_ /** * Wait until condition is triggered. @@ -1741,10 +1743,8 @@ extern "C" { * @return * F_none on success. * - * F_deadlock (with error bit) if operation would cause a deadlock.ead. * F_found_not (with error bit) if no thread by the given ID was found. * F_parameter (with error bit) if a parameter is invalid. - * F_supported_not (with error bit) if the thread is not joinable or is already being joined by another thr * * * @see pthread_detach() @@ -1788,7 +1788,7 @@ extern "C" { * F_deadlock (with error bit) if operation would cause a deadlock.ead. * F_found_not (with error bit) if no thread by the given ID was found. * F_parameter (with error bit) if a parameter is invalid. - * F_supported_not (with error bit) if the thread is not joinable or is already being joined by another thr + * F_supported_not (with error bit) if the thread is not joinable or is already being joined by another thread. * * * @see pthread_join() diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index ba960bb..340e8b5 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -168,7 +168,7 @@ extern "C" { #endif // _di_fll_execute_into_ #ifndef _di_fll_execute_program_ - 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) { + 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, void *result) { #ifndef _di_level_2_parameter_checking_ if (!program && !arguments.used) return F_status_set_error(F_parameter); if (!result) return F_status_set_error(F_parameter); diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index e958a9c..4f4ccf3 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -360,7 +360,7 @@ extern "C" { * @param arguments * An array of strings representing the arguments. * @param option - * A bitwise set of options, such as: fl_execute_parameter_option_exit, and fl_execute_parameter_option_path. + * A bitwise set of options, such as: fl_execute_parameter_option_exit and fl_execute_parameter_option_path. * If fl_execute_parameter_option_exit: this will call exit() at the end of execution (be it success or failure). * If fl_execute_parameter_option_path: this is a program path (such as "/bin/bash"), otherwise this is a program (such as "bash"). * @param result @@ -431,6 +431,7 @@ extern "C" { * @param result * (optional) The code returned after finishing execution of program. * When fl_execute_parameter_option_return is passed via parameter.option, then this instead stores the child process id (PID). + * This is should be of (int *) except when fl_execute_parameter_option_return this should instead be (pid_t *). * Set to NULL to not use. * * @return @@ -494,7 +495,7 @@ extern "C" { * @see fl_environment_path_explode_dynamic() */ #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); + 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, void *result); #endif // _di_fll_execute_program_ #ifdef __cplusplus diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 05c36d3..99e75e3 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -253,7 +253,7 @@ extern "C" { #endif // !defined(_di_fll_execute_program_) #if !defined(_di_fll_execute_program_) - f_status_t private_fll_execute_fork(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, int *result) { + f_status_t private_fll_execute_fork(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, void *result) { int descriptors[2] = { -1, -1 }; @@ -310,18 +310,19 @@ extern "C" { if (parameter && parameter->option & fl_execute_parameter_option_return) { if (result != 0) { - *result = id_process; + pid_t *r = (pid_t *) result; + *r = id_process; } return F_parent; } // have the parent wait for the child process to finish. - waitpid(id_process, result, WUNTRACED | WCONTINUED); + waitpid(id_process, (int *) result, WUNTRACED | WCONTINUED); // this must explicitly check for 0 (as opposed to checking (!result)). if (result != 0) { - if (WIFEXITED(*result)) { + if (WIFEXITED(*((int *) result))) { return F_none; } @@ -352,7 +353,8 @@ extern "C" { close(descriptors[0]); if (result) { - *result = -1; + int *r = (int *) result; + *r = -1; } if (parameter && parameter->option & fl_execute_parameter_option_exit) { @@ -396,7 +398,7 @@ extern "C" { // close the write pipe for the child when done. close(descriptors[0]); - const f_status_t status = private_fll_execute_as_child(*as, parameter, result); + const f_status_t status = private_fll_execute_as_child(*as, parameter, (int *) result); if (F_status_is_error(status)) { return status; @@ -406,7 +408,8 @@ extern "C" { const int code = parameter && (parameter->option & fl_execute_parameter_option_path) ? execv(program, fixed_arguments) : execvp(program, fixed_arguments); if (result) { - *result = code; + int *r = (int *) result; + *r = code; } if (parameter && parameter->option & fl_execute_parameter_option_exit) { @@ -418,7 +421,7 @@ extern "C" { #endif // !defined(_di_fll_execute_program_) #if !defined(_di_fll_execute_program_) - f_status_t private_fll_execute_fork_data(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, int *result) { + f_status_t private_fll_execute_fork_data(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, void *result) { int descriptors[2] = { -1, -1 }; @@ -479,18 +482,19 @@ extern "C" { if (parameter && parameter->option & fl_execute_parameter_option_return) { if (result != 0) { - *result = id_process; + pid_t *r = (pid_t *) result; + *r = id_process; } return F_parent; } // have the parent wait for the child process to finish. - waitpid(id_process, result, WUNTRACED | WCONTINUED); + waitpid(id_process, (int *) result, WUNTRACED | WCONTINUED); // this must explicitly check for 0 (as opposed to checking (!result)). if (result != 0) { - if (WIFEXITED(*result)) { + if (WIFEXITED(*((int *) result))) { return F_none; } @@ -521,7 +525,8 @@ extern "C" { close(descriptors[0]); if (result) { - *result = -1; + int *r = (int *) result; + *r = -1; } if (parameter && parameter->option & fl_execute_parameter_option_exit) { @@ -563,7 +568,7 @@ extern "C" { dup2(descriptors[0], f_type_descriptor_input); if (as) { - const f_status_t status = private_fll_execute_as_child(*as, parameter, result); + const f_status_t status = private_fll_execute_as_child(*as, parameter, (int *) result); if (F_status_is_error(status)) { return status; @@ -576,7 +581,8 @@ extern "C" { close(descriptors[0]); if (result) { - *result = code; + int *r = (int *) result; + *r = code; } if (parameter && parameter->option & fl_execute_parameter_option_exit) { diff --git a/level_2/fll_execute/c/private-execute.h b/level_2/fll_execute/c/private-execute.h index 1324303..2160a4c 100644 --- a/level_2/fll_execute/c/private-execute.h +++ b/level_2/fll_execute/c/private-execute.h @@ -202,6 +202,7 @@ extern "C" { * @param result * (optional) The code returned after finishing execution of program. * When fl_execute_parameter_option_return is passed via parameter.option, then this instead stores the child process id (PID). + * This is should be of (int *) except when fl_execute_parameter_option_return this should instead be (pid_t *). * Set to NULL to not use. * * @return @@ -239,7 +240,7 @@ extern "C" { * @see fll_execute_program() */ #if !defined(_di_fll_execute_program_) - extern f_status_t private_fll_execute_fork(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, int *result) f_gcc_attribute_visibility_internal; + extern f_status_t private_fll_execute_fork(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, void *result) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fll_execute_program_) /** @@ -274,6 +275,7 @@ extern "C" { * @param result * (optional) The code returned after finishing execution of program. * When fl_execute_parameter_option_return is passed via parameter.option, then this instead stores the child process id (PID). + * This is should be of (int *) except when fl_execute_parameter_option_return this should instead be (pid_t *). * Set to NULL to not use. * * @return @@ -310,7 +312,7 @@ extern "C" { * @see fll_execute_program() */ #if !defined(_di_fll_execute_program_) - extern f_status_t private_fll_execute_fork_data(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, int *result) f_gcc_attribute_visibility_internal; + extern f_status_t private_fll_execute_fork_data(const f_string_t program, const f_string_t fixed_arguments[], fl_execute_parameter_t * const parameter, fl_execute_as_t * const as, void *result) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fll_execute_program_) /** diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 953e625..a7f8f7d 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -668,7 +668,7 @@ extern "C" { fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(fl_execute_parameter_option_path, &data_build.environment, &signals, 0); - *status = fll_execute_program(path.string, arguments, ¶meter, 0, &return_code); + *status = fll_execute_program(path.string, arguments, ¶meter, 0, (void *) &return_code); f_macro_string_dynamics_t_delete_simple(arguments); diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 2e4d4d7..e132de0 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -43,7 +43,7 @@ extern "C" { fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(0, &environment, &signals, 0); - *status = fll_execute_program(program.string, arguments, ¶meter, 0, &return_code); + *status = fll_execute_program(program.string, arguments, ¶meter, 0, (void *) &return_code); if (fake_signal_received(data)) { *status = F_status_set_error(F_signal); diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index 67c7af7..1eb7907 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -3818,7 +3818,7 @@ extern "C" { fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(as_shell ? 0 : fl_execute_parameter_option_path, &data_make->environment, &signals, 0); - status = fll_execute_program(program.string, arguments, ¶meter, 0, &return_code); + status = fll_execute_program(program.string, arguments, ¶meter, 0, (void *) &return_code); if (status == F_status_set_error(F_signal)) { return status; diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 3898b6c..7dd4f67 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -266,7 +266,7 @@ extern "C" { parameters.array[4].used = 9; parameters.array[5].used = 6; - status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, 0, &return_code); + status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -299,7 +299,7 @@ extern "C" { parameters.array[4].used = 9; parameters.array[5].used = 6; - status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, 0, &return_code); + status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -328,7 +328,7 @@ extern "C" { parameters.array[2].used = 9; parameters.array[3].used = 6; - status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, 0, &return_code); + status = fll_execute_program((f_string_t) firewall_tool_iptables, parameters, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index fbb64ed..e8ab5a8 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -752,7 +752,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi fprintf(f_type_debug, "\n"); } - status = fll_execute_program((f_string_t) current_tool, arguments, 0, 0, &return_code); + status = fll_execute_program((f_string_t) current_tool, arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -826,7 +826,7 @@ f_status_t firewall_perform_commands(const firewall_local_data_t local, const fi fprintf(f_type_debug, "\n"); } - status = fll_execute_program(current_tool, arguments, 0, 0, &return_code); + status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -1067,7 +1067,7 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } tool = firewall_program_iptables; - status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, 0, &return_code); + status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -1088,7 +1088,7 @@ f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, f } tool = firewall_program_ip6tables; - status = fll_execute_program((f_string_t) firewall_tool_ip6tables, arguments, 0, 0, &return_code); + status = fll_execute_program((f_string_t) firewall_tool_ip6tables, arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -1176,7 +1176,7 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { fprintf(f_type_debug, "\n"); } - status = fll_execute_program(tools[i], arguments, 0, 0, &return_code); + status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -1236,7 +1236,7 @@ f_status_t firewall_delete_chains(const firewall_data_t data) { fprintf(f_type_debug, "\n"); } - status = fll_execute_program(tools[i], arguments, 0, 0, &return_code); + status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { @@ -1318,7 +1318,7 @@ f_status_t firewall_default_lock(const firewall_data_t data) { fprintf(f_type_debug, "\n"); } - status = fll_execute_program(tools[j], arguments, 0, 0, &return_code); + status = fll_execute_program(tools[j], arguments, 0, 0, (void *) &return_code); // immediately exit child process, @todo this may require additional memory deallocation and relating changes. if (status == F_child) { -- 1.8.3.1