From 9445331df8b899b10333fe9a6fbb2aab9f447a6b Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 26 Nov 2023 19:10:42 -0800 Subject: [PATCH] Create files/directories with more permissions; Files are created with 664 (though usually modified by umask). Directories are created with 755 permissions. Main motivation is to allow adb to access files on Android 12+ --- src/core/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/fs.c b/src/core/fs.c index 2ab7e0813..2e37f6cc4 100644 --- a/src/core/fs.c +++ b/src/core/fs.c @@ -200,7 +200,7 @@ bool fs_open(const char* path, char mode, fs_handle* file) { default: return false; } struct stat stats; - file->fd = open(path, flags, S_IRUSR | S_IWUSR); + file->fd = open(path, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); return file->fd >= 0 && !fstat(file->fd, &stats) && !S_ISDIR(stats.st_mode); } @@ -279,7 +279,7 @@ bool fs_remove(const char* path) { } bool fs_mkdir(const char* path) { - return mkdir(path, S_IRWXU) == 0; + return mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0; } bool fs_list(const char* path, fs_list_cb* callback, void* context) {