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+

(cherry picked from commit 9445331df8)
This commit is contained in:
bjorn 2023-11-26 19:10:42 -08:00
parent 0e9171e2dd
commit 35228f1838
1 changed files with 2 additions and 2 deletions

View File

@ -183,7 +183,7 @@ bool fs_open(const char* path, OpenMode mode, fs_handle* file) {
case OPEN_APPEND: flags = O_APPEND | O_WRONLY | O_CREAT; break;
default: return false;
}
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;
}
@ -249,7 +249,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) {