diff options
author | Brian Kendall <brian@briankendall.net> | 2022-04-07 19:49:45 -0400 |
---|---|---|
committer | Brian Kendall <brian@briankendall.net> | 2022-04-07 19:49:45 -0400 |
commit | 81943e06bc08e34a5e68931826ca414881c92694 (patch) | |
tree | 5844562a306ce783015918038771d5742a01b01b | |
parent | a67463910702ba4ebd2d28631fe841f3c3888cbe (diff) | |
download | unionfs-fuse-git-81943e06bc08e34a5e68931826ca414881c92694.tar.gz |
Disallow replacing a file on a different branch with preserve_branch
-rw-r--r-- | src/fuse_ops.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fuse_ops.c b/src/fuse_ops.c index adec4e5..1755eda 100644 --- a/src/fuse_ops.c +++ b/src/fuse_ops.c @@ -492,6 +492,14 @@ static int unionfs_rename(const char *from, const char *to, unsigned int flags) if (i == -1) RETURN(-errno); if (uopt.preserve_branch && uopt.branches[i].rw) { + int existing = find_rorw_branch(to); + + if (existing != -1 && existing != i) { + USYSLOG(LOG_ERR, "%s: from would overwrite to on a different branch, which" + "is not supported.\n", __func__, i, j); + RETURN(-EXDEV); + } + if (branch_contains_file_or_parent_dir(i, to)) { DBG("preserving branch\n"); j = i; |