summaryrefslogtreecommitdiffstats
path: root/drivers/unix/file_access_unix.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-18 16:31:05 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-18 16:31:05 +0200
commitb7976f4ad65bbda075f400843a40d6c75c385b49 (patch)
tree23144b36782b25c2f3a8c124b4d270273c9e915a /drivers/unix/file_access_unix.cpp
parentd63794d466626fd0d176a1ce9ee558fdaf8b3fe5 (diff)
parent131e49bf1377fe78a0f3c48a76d03f629b3faa64 (diff)
downloadredot-engine-b7976f4ad65bbda075f400843a40d6c75c385b49.tar.gz
Merge pull request #78347 from bruvzg/unix_fix_temp_chmod
[Unix] Fix temporary file permissions.
Diffstat (limited to 'drivers/unix/file_access_unix.cpp')
-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);