From 71b8a738d287cd7fbee4a781c949e09d1eea7524 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 26 May 2020 23:52:02 -0500 Subject: [PATCH] Progress: featureless make Get umask at start (done at start to limit the non-atomic nature of the poorly defined POSIX umask()). Begin setting up for directory copy operations. f_file_create() no longer accepts de-reference parameter. --- level_3/fake/c/fake.h | 2 ++ level_3/fake/c/main.c | 6 ++++++ level_3/fake/c/private-build.c | 5 +++++ level_3/fake/c/private-skeleton.c | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 5bcb4f5..6ddef5e 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -416,6 +416,7 @@ extern "C" { f_string_lengths remaining; bool process_pipe; + mode_t umask; uint8_t operation; uint8_t verbosity; @@ -477,6 +478,7 @@ extern "C" { f_string_lengths_initialize, \ F_false, \ 0, \ + 0, \ fake_verbosity_normal, \ f_string_dynamic_initialize, \ f_string_dynamics_initialize, \ diff --git a/level_3/fake/c/main.c b/level_3/fake/c/main.c index e5cb91a..882498f 100644 --- a/level_3/fake/c/main.c +++ b/level_3/fake/c/main.c @@ -4,6 +4,12 @@ int main(const unsigned long argc, const f_string *argv) { const f_console_arguments arguments = { argc, argv }; fake_data data = fake_data_initialize; + // @fixme: bad design in POSIX where there is no get umask without setting it. + data.umask = umask(0); + + // restore umask. + umask(data.umask); + f_status status = fake_main(arguments, &data); if (F_status_is_error(status)) { diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 676a516..db77d0d 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -366,6 +366,11 @@ extern "C" { return status; } + f_directory_statuss failures = f_directory_statuss_initialize; + f_directory_mode mode = f_directory_mode_initialize; + + f_macro_directory_mode_set_default_umask(mode, data.umask); + // @todo: may have to process all data intended to be used in parameters, exploding them into console parameters. // Steps: // 1) copy sources settings to build settings diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 951e7ec..0804aed 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -182,7 +182,7 @@ extern "C" { mode = f_file_mode_all_rwx; } - status = f_file_create(path.string, mode, F_true, F_true); + status = f_file_create(path.string, mode, F_true); if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { -- 1.8.3.1