From: Kevin Day Date: Thu, 31 Mar 2022 01:31:52 +0000 (-0500) Subject: Update: Add umask integer to fll_program_data_t. X-Git-Tag: 0.5.9~19 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=50c6b0458388fdf9dad88050a79aae1016379ade;p=fll Update: Add umask integer to fll_program_data_t. This should be a standard practice that ideally must go away if the POSIX standard ever fixes that idiotic umask() design. Never under any circumstances should a read-only operation result require a write operation! I am forced to work around this, so I might as well provide a standard practice work-around. --- diff --git a/level_2/fll_program/c/program/common.h b/level_2/fll_program/c/program/common.h index 5733e5f..4d2451f 100644 --- a/level_2/fll_program/c/program/common.h +++ b/level_2/fll_program/c/program/common.h @@ -32,21 +32,26 @@ extern "C" { * * Complex programs or programs that need more data passed via the main should implement their own version of this. * - * parameters: The state of pre-defined parameters passed to the program. - * process_pipe: Designate whether or not to process the input pipe. + * The umask() has design flaws as per specification that requires the umask be changed to read the value! + * As a work-around, a umask variable is provided here so that umask() only ever need be called once. + * * child: Reserved for a child process, often representing the child return status or the child process ID. - * output: The output file for general printing. + * context: The color context. * error: The output file for error printing. - * warning: The output file for warning printing. + * output: The output file for general printing. + * parameters: The state of pre-defined parameters passed to the program. + * process_pipe: Designate whether or not to process the input pipe. * signal: The process signal management structure. * signal_check: A counter used to map to for reducing the amount of actual signal check calls. - * context: The color context. + * umask: The umask settings, needed for avoiding calls to umask() to read the current umask. + * warning: The output file for warning printing. */ #ifndef _di_fll_program_data_t_ typedef struct { f_console_parameters_t parameters; uint16_t signal_check; + mode_t umask; bool process_pipe; int child; @@ -64,6 +69,7 @@ extern "C" { f_console_parameters_t_initialize, \ 0, \ 0, \ + 0, \ F_false, \ fl_print_t_initialize, \ macro_fl_print_t_initialize_error(), \