X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/eabc85ef5ecd7ed9892ee3d9562468dbb84cbef5..c78e4ea905bb31d965c9a2b2336bb0f9695ff0f2:/log.c diff --git a/log.c b/log.c index 5d59419e..609f3a58 100644 --- a/log.c +++ b/log.c @@ -53,12 +53,12 @@ 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[]; +extern char curr_dir[MAXPATHLEN]; extern char *module_dir; extern unsigned int module_dirlen; -extern char sender_file_sum[]; +extern char sender_file_sum[MAX_DIGEST_LEN]; static int log_initialised; static int logfile_was_closed; @@ -258,20 +258,22 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8) if (len < 0) exit_cleanup(RERR_MESSAGEIO); - if (msgs2stderr && code != FLOG) { - f = stderr; + if (msgs2stderr > 0 && code != FLOG) goto output_msg; - } 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; @@ -312,8 +314,10 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8) /* TODO: can we send the error to the user somehow? */ return; } + msgs2stderr = -1; } +output_msg: switch (code) { case FERROR_XFER: got_xfer_error = 1; @@ -323,13 +327,13 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8) f = stderr; break; case FINFO: - f = am_server ? stderr : stdout; + case FCLIENT: + f = msgs2stderr ? stderr : stdout; break; default: exit_cleanup(RERR_MESSAGEIO); } -output_msg: if (output_needs_newline) { fputc('\n', f); output_needs_newline = 0; @@ -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);