Made create to grant permissions automatically.

Creating files grants permanent permissions to them now. This makes
sense because if a program creates a new file, then it clearly can't
steal any data. This is particularly useful for programs which open an
obscene amount of auxilary files (e.g. neovim with a huge amount of
plugins).
This commit is contained in:
BritishTeapot
2025-03-30 19:48:11 +02:00
parent 62f3e5bde9
commit 57091bf0ce
2 changed files with 21 additions and 13 deletions

View File

@@ -36,6 +36,7 @@
#include <sys/file.h> /* flock(2) */
#include "fuse_operations.h"
#include "perm_permissions_table.h"
#include "sourcefs.h"
#include "ui-socket.h"
@@ -476,7 +477,7 @@ static int xmp_utimens(const char *path, const struct timespec ts[2],
static int xmp_create(const char *path, mode_t mode,
struct fuse_file_info *fi) {
int fd;
int fd = -1;
struct process_info pi;
struct fuse_context *fc = fuse_get_context();
@@ -486,10 +487,14 @@ static int xmp_create(const char *path, mode_t mode,
// fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
/*
if (!interactive_access(real_filename(path), pi)) {
free(pi.name);
return -EACCES;
}
*/
give_perm_access(real_filename(path), pi);
free(pi.name);