X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/20caffd2b361bcad51692998411e4cc566c04b40..5692657757a6c0e3ba60320719ef51af6f78c909:/rsync.c diff --git a/rsync.c b/rsync.c index 3008e2db..a3f9b950 100644 --- a/rsync.c +++ b/rsync.c @@ -46,7 +46,6 @@ extern int inc_recurse; extern int inplace; extern int flist_eof; extern int file_old_total; -extern int msgs2stderr; extern int keep_dirlinks; extern int make_backups; extern struct file_list *cur_flist, *first_flist, *dir_flist; @@ -160,8 +159,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 +170,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 +264,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;