aboutsummaryrefslogtreecommitdiffstats
path: root/token.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2011-11-21 09:22:14 -0800
committerWayne Davison <wayned@samba.org>2011-11-21 09:22:14 -0800
commit7da17144fd764a2420a8d08897475c0b7fdbf956 (patch)
tree4337e25391cd11f586824da4284b8e6a6ad516a4 /token.c
parentcbdff74b44b25ce713739b9c1fb4db67610c675e (diff)
downloadandroid_external_rsync-7da17144fd764a2420a8d08897475c0b7fdbf956.tar.gz
android_external_rsync-7da17144fd764a2420a8d08897475c0b7fdbf956.tar.bz2
android_external_rsync-7da17144fd764a2420a8d08897475c0b7fdbf956.zip
Add compatibility with an unmodified zlib.
Diffstat (limited to 'token.c')
-rw-r--r--token.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/token.c b/token.c
index 381d5c1f..7628e2ee 100644
--- a/token.c
+++ b/token.c
@@ -21,7 +21,11 @@
#include "rsync.h"
#include "itypes.h"
-#include "zlib/zlib.h"
+#include <zlib.h>
+
+#ifndef Z_INSERT_ONLY
+#define Z_INSERT_ONLY Z_SYNC_FLUSH
+#endif
extern int do_compression;
extern int protocol_version;
@@ -414,14 +418,16 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
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);
- if (r != Z_OK || tx_strm.avail_in != 0) {
- rprintf(FERROR, "deflate on token returned %d (%d bytes left)\n",
- r, tx_strm.avail_in);
- exit_cleanup(RERR_STREAMIO);
- }
+ do {
+ tx_strm.next_out = (Bytef *) obuf;
+ tx_strm.avail_out = AVAIL_OUT_SIZE(CHUNK_SIZE);
+ r = deflate(&tx_strm, Z_INSERT_ONLY);
+ if (r != Z_OK) {
+ rprintf(FERROR, "deflate on token returned %d (%d bytes left)\n",
+ r, tx_strm.avail_in);
+ exit_cleanup(RERR_STREAMIO);
+ }
+ } while (tx_strm.avail_in != 0);
} while (toklen > 0);
}
}