From: Wayne Davison Date: Mon, 7 Sep 2015 16:46:31 +0000 (-0700) Subject: Fixed logging of %b & %c when using --log-file. X-Git-Tag: v3.1.2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cce44865c1ac64a434390b96489252ed576ef951;p=thirdparty%2Frsync.git 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. --- 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);