summaryrefslogtreecommitdiffstats
path: root/drivers/unix
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-06-16 23:34:27 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-06-16 23:34:27 +0300
commit131e49bf1377fe78a0f3c48a76d03f629b3faa64 (patch)
treeb8ee9f7ccab5afa87abe8937a97f22c39c175e66 /drivers/unix
parentfa268be823b97095245f731ad59335a935e6b0ba (diff)
downloadredot-engine-131e49bf1377fe78a0f3c48a76d03f629b3faa64.tar.gz
[Unix] Fix temporary file permissions.
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/file_access_unix.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index e9affe41af..45f9f14dab 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);