mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-23 22:28:16 -04:00
Fix --compress data-duplication bug.
This commit is contained in:
1 parent
37a729768b
commit
cbdff74b44
2 files changed
+6
-1
No files matched your search
@@ -103,7 +103,7 @@
|
||||
/* This is used when working on a new protocol version in CVS, and should
|
||||
* be a new non-zero value for each CVS change that affects the protocol.
|
||||
* It must ALWAYS be 0 when the protocol goes final (and NEVER before)! */
|
||||
#define SUBPROTOCOL_VERSION 13
|
||||
#define SUBPROTOCOL_VERSION 14
|
||||
|
||||
/* We refuse to interoperate with versions that are not in this range.
|
||||
* Note that we assume we'll work with later versions: the onus is on
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "zlib/zlib.h"
|
||||
|
||||
extern int do_compression;
|
||||
extern int protocol_version;
|
||||
extern int module_id;
|
||||
extern int def_compress_level;
|
||||
extern char *skip_compress;
|
||||
@@ -411,6 +412,8 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
|
||||
toklen -= n1;
|
||||
tx_strm.next_in = (Bytef *)map_ptr(buf, offset, n1);
|
||||
tx_strm.avail_in = n1;
|
||||
if (protocol_version >= 31) /* Newer protocols avoid a data-duplicating bug */
|
||||
offset += n1;
|
||||
tx_strm.next_out = (Bytef *) obuf;
|
||||
tx_strm.avail_out = AVAIL_OUT_SIZE(CHUNK_SIZE);
|
||||
r = deflate(&tx_strm, Z_INSERT_ONLY);
|
||||
@@ -593,6 +596,8 @@ static void see_deflate_token(char *buf, int32 len)
|
||||
} else {
|
||||
rx_strm.next_in = (Bytef *)buf;
|
||||
rx_strm.avail_in = blklen;
|
||||
if (protocol_version >= 31) /* Newer protocols avoid a data-duplicating bug */
|
||||
buf += blklen;
|
||||
len -= blklen;
|
||||
blklen = 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user