Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/tup/server/fuse_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ static int tup_fs_unlink(const char *path)
{
struct mapping *map;
struct file_info *finfo;
struct tup_entry *match = NULL;

if(context_check() < 0)
return -EPERM;
Expand All @@ -870,10 +871,16 @@ static int tup_fs_unlink(const char *path)
put_finfo(finfo);
tup_fuse_handle_file(path, NULL, ACCESS_UNLINK);
return 0;
} else {
const char *peeled = peel(path);
if(exclusion_match(stderr, &finfo->exclusion_root, peeled, &match) < 0) {
put_finfo(finfo);
return -ENOSYS;
}
}
put_finfo(finfo);
}
if(strstr(path, ".fuse_hidden") != NULL) {
if(match || strstr(path, ".fuse_hidden") != NULL) {
/* Similar to the rename check for .fuse_hidden, this shows up
* in Arch sometimes.
*/
Expand All @@ -892,9 +899,10 @@ static int tup_fs_unlink(const char *path)
static int tup_fs_rmdir(const char *path)
{
struct tmpdir *tmpdir;
const char *peeled;
const char *peeled = NULL;
struct file_info *finfo;
struct mapping *map;
struct tup_entry *match = NULL;

if(context_check() < 0)
return -EPERM;
Expand Down Expand Up @@ -928,8 +936,20 @@ static int tup_fs_rmdir(const char *path)
return 0;
}
}

if(exclusion_match(stderr, &finfo->exclusion_root, peeled, &match) < 0) {
put_finfo(finfo);
return -ENOSYS;
}

put_finfo(finfo);
}
if (match) {
int res = rmdir(peeled);
if(res < 0)
return -errno;
return 0;
}
fprintf(stderr, "tup error: Unable to rmdir a directory not created during this job: %s\n", peel(path));
return -EPERM;
}
Expand Down