When using --iconv, if a server-side receiver can't convert a filename,
authorWayne Davison <wayned@samba.org>
Sat, 2 Aug 2008 17:26:17 +0000 (10:26 -0700)
committerWayne Davison <wayned@samba.org>
Sat, 2 Aug 2008 17:26:17 +0000 (10:26 -0700)
it now outputs the name back to the client without mangling the charset.

flist.c
io.c
log.c
rsync.h

diff --git a/flist.c b/flist.c
index 061d1be..d7f095d 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -696,7 +696,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
 
                if (iconvbufs(ic_recv, &inbuf, &outbuf, 0) < 0) {
                        io_error |= IOERR_GENERAL;
-                       rprintf(FERROR_XFER,
+                       rprintf(FERROR_UTF8,
                            "[%s] cannot convert filename: %s (%s)\n",
                            who_am_i(), lastname, strerror(errno));
                        outbuf.len = 0;
diff --git a/io.c b/io.c
index fe9bcec..2756b14 100644 (file)
--- a/io.c
+++ b/io.c
@@ -454,6 +454,7 @@ static void read_msg_fd(void)
                got_flist_entry_status(FES_NO_SEND, buf);
                break;
        case MSG_ERROR_SOCKET:
+       case MSG_ERROR_UTF8:
        case MSG_CLIENT:
                if (!am_generator)
                        goto invalid_msg;
diff --git a/log.c b/log.c
index 13c9311..609f3a5 100644 (file)
--- a/log.c
+++ b/log.c
@@ -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;
diff --git a/rsync.h b/rsync.h
index c487d46..320d340 100644 (file)
--- a/rsync.h
+++ b/rsync.h
@@ -211,6 +211,7 @@ enum logcode {
     FERROR_XFER=1, FINFO=2, /* sent over socket for any protocol */
     FERROR=3, FWARNING=4, /* sent over socket for protocols >= 30 */
     FERROR_SOCKET=5, FLOG=6, /* only sent via receiver -> generator pipe */
+    FERROR_UTF8=8, /* only sent via receiver -> generator pipe */
     FCLIENT=7 /* never transmitted (e.g. server converts to FINFO) */
 };
 
@@ -221,6 +222,7 @@ enum msgcode {
        MSG_ERROR_XFER=FERROR_XFER, MSG_INFO=FINFO, /* remote logging */
        MSG_ERROR=FERROR, MSG_WARNING=FWARNING, /* protocol-30 remote logging */
        MSG_ERROR_SOCKET=FERROR_SOCKET, /* sibling logging */
+       MSG_ERROR_UTF8=FERROR_UTF8, /* sibling logging */
        MSG_LOG=FLOG, MSG_CLIENT=FCLIENT, /* sibling logging */
        MSG_REDO=9,     /* reprocess indicated flist index */
        MSG_FLIST=20,   /* extra file list over sibling socket */