aboutsummaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-09-07 21:45:19 +0000
committerWayne Davison <wayned@samba.org>2004-09-07 21:45:19 +0000
commit3bb400ca14026463d1609a3ddd24357d4712e2d8 (patch)
tree7aa854480cffd565d9d395b1d75c1f06ea455fa1 /match.c
parentcd6aa5b5c0a8bcffe76f3c83071d80d93b7be533 (diff)
downloadandroid_external_rsync-3bb400ca14026463d1609a3ddd24357d4712e2d8.tar.gz
android_external_rsync-3bb400ca14026463d1609a3ddd24357d4712e2d8.tar.bz2
android_external_rsync-3bb400ca14026463d1609a3ddd24357d4712e2d8.zip
If --backup was used with --inplace, we don't limit the basis-file
matches (as we normally would) because the receiver is using the backup-file as the basis-file.
Diffstat (limited to 'match.c')
-rw-r--r--match.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/match.c b/match.c
index c09a2223..b9336b86 100644
--- a/match.c
+++ b/match.c
@@ -24,6 +24,7 @@ extern int am_server;
extern int do_progress;
extern int checksum_seed;
extern int inplace;
+extern int make_backups;
typedef unsigned short tag;
@@ -204,7 +205,7 @@ static void hash_search(int f,struct sum_struct *s,
/* inplace: ensure chunk's offset is either >= our
* offset or that the data didn't move. */
- if (inplace && s->sums[i].offset < offset
+ if (inplace && !make_backups && s->sums[i].offset < offset
&& !(s->sums[i].flags & SUMFLG_SAME_OFFSET))
continue;
@@ -226,7 +227,7 @@ static void hash_search(int f,struct sum_struct *s,
/* If inplace is enabled, the best possible match is
* one with an identical offset, so we prefer that over
* the following want_i optimization. */
- if (inplace) {
+ if (inplace && !make_backups) {
do {
size_t i2 = targets[j].i;
if (s->sums[i2].offset != offset)
@@ -249,7 +250,7 @@ static void hash_search(int f,struct sum_struct *s,
/* we've found a match, but now check to see
* if want_i can hint at a better match. */
if (i != want_i && want_i < s->count
- && (!inplace || s->sums[want_i].offset >= offset
+ && (!inplace || make_backups || s->sums[want_i].offset >= offset
|| s->sums[want_i].flags & SUMFLG_SAME_OFFSET)
&& sum == s->sums[want_i].sum1
&& memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {