diff options
author | Brian Kendall <brian@briankendall.net> | 2022-03-31 19:27:16 -0400 |
---|---|---|
committer | Radek Podgorny <radek@podgorny.cz> | 2022-07-02 18:36:54 +0200 |
commit | 568b44d121b1fc707212994bde9809cd044b3083 (patch) | |
tree | 7e0e0a6ac656092e70bb8c0233f866441a6306a4 /src | |
parent | a4560973d309e2c441fa34acb6c1bf76dcdf1ad8 (diff) | |
download | unionfs-fuse-git-568b44d121b1fc707212994bde9809cd044b3083.tar.gz |
In progress commit
Diffstat (limited to 'src')
-rw-r--r-- | src/fuse_ops.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/fuse_ops.c b/src/fuse_ops.c index 0eb29df..394c81b 100644 --- a/src/fuse_ops.c +++ b/src/fuse_ops.c @@ -490,9 +490,19 @@ static int unionfs_rename(const char *from, const char *to, unsigned int flags) int i = find_rorw_branch(from); if (i == -1) RETURN(-errno); - if (uopt.preserve_branch && uopt.branches[i].rw && branch_contains_file_or_parent_dir(i, to)) { - DBG("file can stay in same branch\n"); - j = i; + if (uopt.preserve_branch && uopt.branches[i].rw) { + if (branch_contains_file_or_parent_dir(i, to)) { + DBG("...from branch contains target directory, no need to change branches\n"); + j = i; + } else { + DBG("...creating target directory in from branch, no need to change branches\n"); + + if (path_create_cutlast(to, j, i) == 0) { + j = i; + } else { + DBG("...failed to create path in from branch\n"); + } + } } if (!uopt.branches[i].rw) { |