summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2020-06-04 21:21:05 -0700
committerWayne Davison <wayne@opencoder.net>2020-06-04 21:40:43 -0700
commit916faecb835990164e24ddbfe801acffce3ebf79 (patch)
tree126bcb045a4e91391cf2d63984bd2f64c43cd2f7
parent5d7b71b7a7d76d334b104d2e5127a0d29d36d99c (diff)
downloadrsync-916faecb835990164e24ddbfe801acffce3ebf79.tar.gz
Only sender can output non-final stats on error
The receiving side's stats are split between 2 processes until the very end.
-rw-r--r--clientserver.c2
-rw-r--r--log.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/clientserver.c b/clientserver.c
index b6067ccb..8df14947 100644
--- a/clientserver.c
+++ b/clientserver.c
@@ -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 ded8045b..58ad2736 100644
--- 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;