]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Improved the handling of --msgs2stderr a little more.
authorWayne Davison <wayned@samba.org>
Mon, 21 Jul 2008 05:20:17 +0000 (22:20 -0700)
committerWayne Davison <wayned@samba.org>
Mon, 21 Jul 2008 05:27:23 +0000 (22:27 -0700)
cleanup.c
log.c

index 91467825685cb8a71e640832f56835d3999935c8..22e2e35ff9acb4163f89dfac97bfeca5d086ace9 100644 (file)
--- a/cleanup.c
+++ b/cleanup.c
@@ -105,7 +105,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
                code = exit_code;
 
        /* If this is the exit at the end of the run, the server side
-        * should not attempt to output a message (see log.c). */
+        * should not attempt to output a message (see log_exit()). */
        if (am_server && code == 0)
                am_server = 2;
 
diff --git a/log.c b/log.c
index 5d59419e279de2e6ffac1654e6f271f1fa74362f..58c6bb19c9de5b41ed0b79ea8e14281db5a79322 100644 (file)
--- a/log.c
+++ b/log.c
@@ -258,10 +258,8 @@ 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);
@@ -312,8 +310,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 +323,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;