X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/ff41a59f58614ff4e57b4c97b586dcd46e43cc5c..f0359dd00d60d72c4b3dec85de8e490692f6015c:/log.c diff --git a/log.c b/log.c index 8619e4d6..61a8bd05 100644 --- a/log.c +++ b/log.c @@ -91,10 +91,11 @@ void rwrite(enum logcode code, char *buf, int len) { FILE *f=NULL; extern int am_daemon; + extern int am_server; extern int quiet; /* recursion can happen with certain fatal conditions */ - if (quiet != 0 && code == FINFO) return; + if (quiet && code == FINFO) return; if (len < 0) exit_cleanup(RERR_MESSAGEIO); @@ -105,7 +106,15 @@ void rwrite(enum logcode code, char *buf, int len) return; } - if (io_error_write(log_error_fd, code, buf, strlen(buf))) return; + /* first try to pass it off the our sibling */ + if (am_server && io_error_write(log_error_fd, code, buf, len)) { + return; + } + + /* then try to pass it to the other end */ + if (am_server && io_multiplex_write(code, buf, len)) { + return; + } if (am_daemon) { static int depth; @@ -117,9 +126,7 @@ void rwrite(enum logcode code, char *buf, int len) depth++; log_open(); - if (!io_multiplex_write(code, buf, strlen(buf))) { - logit(priority, buf); - } + logit(priority, buf); depth--; return; @@ -130,7 +137,6 @@ void rwrite(enum logcode code, char *buf, int len) } if (code == FINFO) { - extern int am_server; if (am_server) f = stderr; else @@ -194,7 +200,7 @@ void rflush(enum logcode code) /* a generic logging routine for send/recv, with parameter substitiution */ -static void log_formatted(int fd, +static void log_formatted(enum logcode code, char *format, char *op, struct file_struct *file, struct stats *initial_stats) { @@ -284,7 +290,7 @@ static void log_formatted(int fd, s = p+l; } - rprintf(fd,"%s\n", buf); + rprintf(code,"%s\n", buf); } /* log the outgoing transfer of a file */