extern int protocol_version;
extern int always_checksum;
extern int preserve_times;
+extern int msgs2stderr;
extern int uid_ndx;
extern int gid_ndx;
extern int stdout_format_has_i;
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;
if (len < 0)
exit_cleanup(RERR_MESSAGEIO);
+ 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;
/* TODO: can we send the error to the user somehow? */
return;
}
+ msgs2stderr = -1;
}
+output_msg:
switch (code) {
case FERROR_XFER:
got_xfer_error = 1;
f = stderr;
break;
case FINFO:
- f = am_server ? stderr : stdout;
+ case FCLIENT:
+ f = msgs2stderr ? stderr : stdout;
break;
default:
exit_cleanup(RERR_MESSAGEIO);
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);