]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Fixed logging of %b & %c when using --log-file.
authorWayne Davison <wayned@samba.org>
Mon, 7 Sep 2015 16:46:31 +0000 (09:46 -0700)
committerWayne Davison <wayned@samba.org>
Mon, 7 Sep 2015 17:07:17 +0000 (10:07 -0700)
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.

NEWS
log.c
receiver.c
sender.c

diff --git a/NEWS b/NEWS
index 3fe3d3e3ba79378bc0a3d81d83d2e37756c2eda5..3ab8b2df6cfcc35818e51a138882fa241993cac9 100644 (file)
--- 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 ef2c6ee62143b267c0f1432283019232aecd9ef0..24256debefb4881ad98eb75539ab9ea30dd800be 100644 (file)
--- 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;
index 63f1c12fc2a6cf89d2fd8ece3e18ccd1fb45aa6f..4ea4c091961ace3bb4d6ac3f0c34a40372fc2758 100644 (file)
@@ -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);
index b4a5dbf7c334b82882c978528ee2c1a64e6ab1f1..907cf21cc6206dd0fb59e542ffc481ef3ad7b16a 100644 (file)
--- 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);