When using --iconv, if a server-side receiver can't convert a filename,
[rsync/rsync.git] / log.c
diff --git a/log.c b/log.c
index 6f9a47e..609f3a5 100644 (file)
--- a/log.c
+++ b/log.c
@@ -53,7 +53,7 @@ extern char *logfile_name;
 extern iconv_t ic_chck;
 #endif
 #ifdef ICONV_OPTION
-extern iconv_t ic_send, ic_recv;
+extern iconv_t ic_recv;
 #endif
 extern char curr_dir[MAXPATHLEN];
 extern char *module_dir;
@@ -263,13 +263,17 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8)
 
        if (am_server && msg_fd_out >= 0) {
                assert(!is_utf8);
-               /* Pass the message to our sibling. */
+               /* Pass the message to our sibling in native charset. */
                send_msg((enum msgcode)code, buf, len, 0);
                return;
        }
 
        if (code == FERROR_SOCKET) /* This gets simplified for a non-sibling. */
                code = FERROR;
+       else if (code == FERROR_UTF8) {
+               is_utf8 = 1;
+               code = FERROR;
+       }
 
        if (code == FCLIENT)
                code = FINFO;
@@ -351,7 +355,7 @@ output_msg:
                int ierrno;
 
                INIT_CONST_XBUF(outbuf, convbuf);
-               INIT_XBUF(inbuf, (char*)buf, len, -1);
+               INIT_XBUF(inbuf, (char*)buf, len, (size_t)-1);
 
                while (inbuf.len) {
                        iconvbufs(ic, &inbuf, &outbuf, 0);