]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Only sender can output non-final stats on error
authorWayne Davison <wayne@opencoder.net>
Fri, 5 Jun 2020 04:21:05 +0000 (21:21 -0700)
committerWayne Davison <wayne@opencoder.net>
Fri, 5 Jun 2020 04:40:43 +0000 (21:40 -0700)
The receiving side's stats are split between 2 processes until the very end.

clientserver.c
log.c

index b6067ccb17f4979c5ac5aa7817d749537fd3d08c..8df149474f168a0541be2e1e449916756e981359 100644 (file)
@@ -1190,7 +1190,7 @@ static void create_pid_file(void)
                int len = snprintf(pidbuf, sizeof pidbuf, "%d\n", (int)pid);
 #ifndef HAVE_FTRUNCATE
                /* What can we do with a too-long file and no truncate? I guess we'll add extra newlines. */
-               while (len < st1.st_size) /* We already verfified that size+1 chars fits in the buffer. */
+               while (len < st1.st_size) /* We already verified that st_size+1 chars fits in the buffer. */
                        pidbuf[len++] = '\n';
                /* We don't need the buffer to end in a '\0' (and we may not have room to add it). */
 #endif
diff --git a/log.c b/log.c
index ded8045b593c6e9a8a81d5b81353822e13d92429..58ad27364ca4879461fe38a941649d9acfac580f 100644 (file)
--- a/log.c
+++ b/log.c
@@ -870,10 +870,14 @@ void log_delete(const char *fname, int mode)
  */
 void log_exit(int code, const char *file, int line)
 {
-       rprintf(FLOG,"sent %s bytes  received %s bytes  total size %s\n",
-               big_num(stats.total_written),
-               big_num(stats.total_read),
-               big_num(stats.total_size));
+       /* The receiving side's stats are split between 2 procs until the
+        * end of the run, so only the sender can output non-final info. */
+       if (code == 0 || am_sender) {
+               rprintf(FLOG,"sent %s bytes  received %s bytes  total size %s\n",
+                       big_num(stats.total_written),
+                       big_num(stats.total_read),
+                       big_num(stats.total_size));
+       }
        if (code != 0 && am_server != 2) {
                const char *name;