From 3f26945cb1a602d3f838507ac77079f649bf9086 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 15 Jan 2011 11:16:49 -0800 Subject: [PATCH] Include backup in map_ptr() to avoid backing up when reading. --- match.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/match.c b/match.c index cbb6fe27..f8a1a8f9 100644 --- a/match.c +++ b/match.c @@ -257,7 +257,11 @@ static void hash_search(int f,struct sum_struct *s, * in the sender's file, we'll output enough literal data * to re-align with the basis file, and get back to seeking * instead of writing. */ - map = (schar *)map_ptr(buf, aligned_offset, l); + backup = (int32)(aligned_offset - last_match); + if (backup < 0) + backup = 0; + map = (schar *)map_ptr(buf, aligned_offset - backup, l + backup) + + backup; sum = get_checksum1((char *)map, l); if (sum != s->sums[i2].sum1) break; -- 2.34.1