aboutsummaryrefslogtreecommitdiffstats
path: root/rsync.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-10-23 22:51:29 -0700
committerWayne Davison <wayned@samba.org>2009-10-23 22:51:29 -0700
commitd8a7290f8621b72139461ed6606cde31fa4d544f (patch)
treed1071f07b582c767dc6bcb16a86eb763184a0b2c /rsync.c
parent3b8f8192227b14e708bf535072485e50f4362270 (diff)
downloadandroid_external_rsync-d8a7290f8621b72139461ed6606cde31fa4d544f.tar.gz
android_external_rsync-d8a7290f8621b72139461ed6606cde31fa4d544f.tar.bz2
android_external_rsync-d8a7290f8621b72139461ed6606cde31fa4d544f.zip
Give iconvbufs() an ICB_INIT flag.
Diffstat (limited to 'rsync.c')
-rw-r--r--rsync.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/rsync.c b/rsync.c
index 3008e2db..2d0de925 100644
--- a/rsync.c
+++ b/rsync.c
@@ -160,8 +160,8 @@ static void wrap_overflow(xbuf *out, int siz)
* "flags", any badly-encoded chars are included verbatim in the "out" xbuf,
* so EILSEQ will not be returned. Likewise for ICB_INCLUDE_INCOMPLETE with
* respect to an incomplete multi-byte char at the end, which ensures that
- * EINVAL is not returned. Anytime "in.pos" is 0 we will reset the iconv()
- * state prior to processing the characters. */
+ * EINVAL is not returned. If ICB_INIT is set, the iconv() conversion state
+ * is initialized prior to processing the characters. */
int iconvbufs(iconv_t ic, xbuf *in, xbuf *out, int flags)
{
ICONV_CONST char *ibuf;
@@ -171,7 +171,7 @@ int iconvbufs(iconv_t ic, xbuf *in, xbuf *out, int flags)
if (!out->size && flags & ICB_EXPAND_OUT)
alloc_xbuf(out, 1024);
- if (!in->pos)
+ if (flags & ICB_INIT)
iconv(ic, NULL, 0, NULL, 0);
ibuf = in->buf + in->pos;
@@ -265,7 +265,7 @@ void send_protected_args(int fd, char *args[])
else if (convert) {
INIT_XBUF_STRLEN(inbuf, args[i]);
iconvbufs(ic_send, &inbuf, &outbuf,
- ICB_EXPAND_OUT | ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE);
+ ICB_EXPAND_OUT | ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE | ICB_INIT);
outbuf.buf[outbuf.len] = '\0';
write_buf(fd, outbuf.buf, outbuf.len + 1);
outbuf.len = 0;