diff options
Diffstat (limited to 'src/fuse_ops.c')
-rw-r--r-- | src/fuse_ops.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/fuse_ops.c b/src/fuse_ops.c index 394c81b..adec4e5 100644 --- a/src/fuse_ops.c +++ b/src/fuse_ops.c @@ -482,6 +482,7 @@ static int unionfs_rename(const char *from, const char *to, unsigned int flags) DBG("from %s to %s\n", from, to); + int res; bool is_dir = false; // is 'from' a file or directory int j = find_rw_branch_cutlast(to); @@ -492,15 +493,14 @@ static int unionfs_rename(const char *from, const char *to, unsigned int flags) 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"); + DBG("preserving branch\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) { + DBG("preserving branch and creating directories to do so\n"); + res = path_create_cutlast(to, j, i); + + if (res == 0) { j = i; - } else { - DBG("...failed to create path in from branch\n"); } } } @@ -526,7 +526,6 @@ static int unionfs_rename(const char *from, const char *to, unsigned int flags) else if (ftype == IS_DIR) is_dir = true; - int res; if (!uopt.branches[i].rw) { // since original file is on a read-only branch, we copied the from file to a writable branch, // but since we will rename from, we also need to hide the from file on the read-only branch |