From: Stephen Seo Date: Wed, 26 Feb 2025 09:42:45 +0000 (+0900) Subject: Set umask on compression-temp-file X-Git-Tag: 1.18^2~4 X-Git-Url: https://git.seodisparate.com/stephenseo/search/main.js?a=commitdiff_plain;h=2608eb4e1c5de6cfd30050a55df4ada31465e670;p=SimpleArchiver Set umask on compression-temp-file Previous behavior created temp files (for compression) with default permissions. This commit uses umask to keep only permissions for the user and deny permissions to others (and restores the umask after creation of the temp file). --- diff --git a/src/helpers.c b/src/helpers.c index 9ec87c2..e4b5921 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -905,7 +905,9 @@ FILE *simple_archiver_helper_temp_dir(const SDArchiverParsed *parsed, } } while (1); + mode_t prev_umask = umask(S_IRWXG | S_IRWXO); FILE *temp_file = fopen(temp_filename, "w+b"); + umask(prev_umask); if (temp_file) { if (out_temp_filename) {