Skip to content

Commit

Permalink
Create files/directories with more permissions;
Browse files Browse the repository at this point in the history
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+
  • Loading branch information
bjornbytes committed Nov 27, 2023
1 parent 9da89b7 commit 9445331
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9445331

Please sign in to comment.