From 7c7462cd3079c27062569dce90f6ae3fa79040b3 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 2 Aug 2008 10:26:17 -0700 Subject: [PATCH] When using --iconv, if a server-side receiver can't convert a filename, it now outputs the name back to the client without mangling the charset. --- flist.c | 2 +- io.c | 1 + log.c | 6 +++++- rsync.h | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/flist.c b/flist.c index 061d1be6..d7f095d4 100644 --- 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 fe9bcec1..2756b148 100644 --- 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 13c9311d..609f3a58 100644 --- 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 c487d46e..320d340c 100644 --- 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 */ -- 2.34.1