From 131e49bf1377fe78a0f3c48a76d03f629b3faa64 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 16 Jun 2023 23:34:27 +0300 Subject: [PATCH] [Unix] Fix temporary file permissions. --- drivers/unix/file_access_unix.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index e9affe41afa..45f9f14dab2 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -108,6 +108,10 @@ Error FileAccessUnix::open_internal(const String &p_path, int p_mode_flags) { last_error = ERR_FILE_CANT_OPEN; return last_error; } + // Fix temporary file permissions (defaults to 0600 instead of 0666 & ~umask). + mode_t mask = umask(022); + umask(mask); + fchmod(fd, 0666 & ~mask); path = String::utf8(cs.ptr()); f = fdopen(fd, mode_string);