Skip to content

Commit

Permalink
disabled trash creation. maybe not the correct method? correct me if so
Browse files Browse the repository at this point in the history
  • Loading branch information
ecpre committed Aug 14, 2023
1 parent 53fcaee commit b1ecaa6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions FuseRedSea.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,14 @@ unsigned long long int add_entry_to_dir(struct redsea_directory* directory, uint
}

static int fuse_rs_file_attributes(const char *path, struct stat *st) {
if (strcmp(path, "/") == 0 || is_directory(path)) {

if (strncmp(path, "/.Trash", 7) == 0) {
errno = ENOENT;
return -errno;

}

else if (strcmp(path, "/") == 0 || is_directory(path)) {
unsigned long long int did = directory_position(path); // did is Directory ID
if (did == -1) return -1;
st->st_size = directory_structs[did]->size;
Expand Down Expand Up @@ -852,6 +859,12 @@ static int fuse_rs_create(const char* path, mode_t perms, struct fuse_file_info*

static int fuse_rs_mkdir(const char* path, mode_t perms) {
unsigned long long int did = directory_position(path);

if (strncmp(path, "/.Trash", 7) == 0) {
errno = EACCES;
return -errno;
}

if (did != -1) {
errno = EEXIST;
return -errno;
Expand Down Expand Up @@ -1053,7 +1066,7 @@ int main(int argc, char **argv) {
//redsea_read_files(rdb, size, image, ".", "");
redsea_read_files(root_directory, "");
}

return fuse_main(argc, argv, &redsea_ops, NULL);

}

0 comments on commit b1ecaa6

Please sign in to comment.