summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2015-09-07 09:46:31 -0700
committerWayne Davison <wayned@samba.org>2015-09-07 10:07:17 -0700
commitcce44865c1ac64a434390b96489252ed576ef951 (patch)
tree123a5cfe272ff5b3ca18ac8e72063ce6d56901d6
parent1983198097f57cb9c2eb44ae51cbf8c2cabccbe4 (diff)
downloadrsync-cce44865c1ac64a434390b96489252ed576ef951.tar.gz
Fixed logging of %b & %c when using --log-file.
The %b and %c escapes were outputting cumulative values when logged via --log-file only (the bug didn't affect daemon transfer logging or the output of the client's --out-format info). Also unified the %b & %c switch case to make it easier to maintain. Fixes bug 11496.
-rw-r--r--NEWS4
-rw-r--r--log.c13
-rw-r--r--receiver.c3
-rw-r--r--sender.c3
4 files changed, 7 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index 3fe3d3e3..3ab8b2df 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ Changes since 3.1.1:
- Don't create an empty backup dir for a transferred file that doesn't
exist yet.
- Allow more than 32 group IDs per user in the daemon's gid=LIST config.
+ - Fix the logging of %b & %c via --log-file (daemon logging was already
+ correct, as was --out-format='%b/%c').
ENHANCEMENTS:
@@ -28,6 +30,8 @@ Changes since 3.1.1:
- Use usleep() for our msleep() function if it is available.
- Added a few extra long-option names to rrsync script, which will make
BackupPC happier.
+ - Made configure choose to use linux xattrs on netbsd (rather than not
+ supporting xattrs).
- Misc. manpage tweaks.
DEVELOPER RELATED:
diff --git a/log.c b/log.c
index ef2c6ee6..24256deb 100644
--- a/log.c
+++ b/log.c
@@ -656,21 +656,10 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
n = auth_user;
break;
case 'b':
- if (!(iflags & ITEM_TRANSFER))
- b = 0;
- else if (am_sender)
- b = total_data_written - initial_data_written;
- else
- b = total_data_read - initial_data_read;
- strlcat(fmt, "s", sizeof fmt);
- snprintf(buf2, sizeof buf2, fmt,
- do_big_num(b, humanize, NULL));
- n = buf2;
- break;
case 'c':
if (!(iflags & ITEM_TRANSFER))
b = 0;
- else if (!am_sender)
+ else if ((!!am_sender) ^ (*p == 'c'))
b = total_data_written - initial_data_written;
else
b = total_data_read - initial_data_read;
diff --git a/receiver.c b/receiver.c
index 63f1c12f..4ea4c091 100644
--- a/receiver.c
+++ b/receiver.c
@@ -672,8 +672,7 @@ int recv_files(int f_in, int f_out, char *local_name)
}
}
- if (!log_before_transfer)
- remember_initial_stats();
+ remember_initial_stats();
if (!do_xfers) { /* log the transfer */
log_item(FCLIENT, file, iflags, NULL);
diff --git a/sender.c b/sender.c
index b4a5dbf7..907cf21c 100644
--- a/sender.c
+++ b/sender.c
@@ -320,8 +320,7 @@ void send_files(int f_in, int f_out)
stats.xferred_files++;
stats.total_transferred_size += F_LENGTH(file);
- if (!log_before_transfer)
- remember_initial_stats();
+ remember_initial_stats();
if (!do_xfers) { /* log the transfer */
log_item(FCLIENT, file, iflags, NULL);