Merge pull request #78347 from bruvzg/unix_fix_temp_chmod

[Unix] Fix temporary file permissions.
This commit is contained in:
Rémi Verschelde 2023-06-18 16:31:05 +02:00
commit b7976f4ad6
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 0 deletions

View File

@ -108,6 +108,10 @@ Error FileAccessUnix::open_internal(const String &p_path, int p_mode_flags) {
last_error = ERR_FILE_CANT_OPEN; last_error = ERR_FILE_CANT_OPEN;
return last_error; 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()); path = String::utf8(cs.ptr());
f = fdopen(fd, mode_string); f = fdopen(fd, mode_string);