diff options
author | Bernd Schubert <bernd.schubert@fastmail.fm> | 2010-06-01 22:41:30 +0200 |
---|---|---|
committer | Bernd Schubert <bernd.schubert@fastmail.fm> | 2010-06-01 22:41:30 +0200 |
commit | 8a3557ac2bf9a83a5252b4efa19f4ae2dc7755f6 (patch) | |
tree | 9cb886fdd4a5768a6c94d2315498090a5ebab229 | |
parent | 2c7b6aca8165aafbc38e71b106ef6339948f236c (diff) | |
download | unionfs-fuse-8a3557ac2bf9a83a5252b4efa19f4ae2dc7755f6.tar.gz |
And another fix for the link problem.
This time it failed, if the the destdir already existed on a higher
level branch.
-rw-r--r-- | src/findbranch.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/findbranch.c b/src/findbranch.c index 9581c3a..36488b3 100644 --- a/src/findbranch.c +++ b/src/findbranch.c @@ -111,9 +111,8 @@ int find_rorw_branch(const char *path) { * @ rw_hint - the rw branch to copy to, set to -1 to autodetect it */ int __find_rw_branch_cutlast(const char *path, int rw_hint) { - DBG_IN(); - int branch = find_rw_branch_cow(path); + DBG("branch = %d\n", branch); if (branch >= 0 || (branch < 0 && errno != ENOENT)) return branch; @@ -127,9 +126,17 @@ int __find_rw_branch_cutlast(const char *path, int rw_hint) { errno = ENOMEM; return -1; } + branch = find_rorw_branch(dname); + DBG("branch = %d\n", branch); - if (branch < 0 || uopt.branches[branch].rw) goto out; + // No branch found, so path does nowhere exist, error + if (branch < 0) goto out; + + // branch is write and we do not care which branch it is (rw_hint == -1) + // or branch is writable and matches rw_hint + if (uopt.branches[branch].rw + && (rw_hint == -1 || branch == rw_hint)) goto out; if (!uopt.cow_enabled) { // So path exists, but is not writable. @@ -145,6 +152,8 @@ int __find_rw_branch_cutlast(const char *path, int rw_hint) { else branch_rw = rw_hint; + DBG("branch_rw = %d\n", branch_rw); + // no writable branch found, we must return an error if (branch_rw < 0) { branch = -1; |