Blame SOURCES/rsync-3.2.3-append-mode.patch

7f5a2e
diff --git a/rsync.1.md b/rsync.1.md
7f5a2e
index ec971ecc..7bb4c5a1 100644
7f5a2e
--- a/rsync.1.md
7f5a2e
+++ b/rsync.1.md
7f5a2e
@@ -949,7 +949,9 @@ your home directory (remove the '=' for that).
7f5a2e
     existing content in the file (it only verifies the content that it is
7f5a2e
     appending).  Rsync skips any files that exist on the receiving side that
7f5a2e
     are not shorter than the associated file on the sending side (which means
7f5a2e
-    that new files are trasnferred).
7f5a2e
+    that new files are trasnferred).  It also skips any files whose size on the
7f5a2e
+    sending side gets shorter during the send negotiations (rsync warns about a
7f5a2e
+    "diminished" file when this happens).
7f5a2e
 
7f5a2e
     This does not interfere with the updating of a file's non-content
7f5a2e
     attributes (e.g.  permissions, ownership, etc.) when the file does not need
7f5a2e
diff --git a/sender.c b/sender.c
7f5a2e
index 94761c26..9cfca134 100644
7f5a2e
--- a/sender.c
7f5a2e
+++ b/sender.c
7f5a2e
@@ -362,6 +362,16 @@ void send_files(int f_in, int f_out)
7f5a2e
 			exit_cleanup(RERR_FILEIO);
7f5a2e
 		}
7f5a2e
 
7f5a2e
+		if (append_mode > 0 && st.st_size < F_LENGTH(file)) {
7f5a2e
+			rprintf(FWARNING, "skipped diminished file: %s\n",
7f5a2e
+				full_fname(fname));
7f5a2e
+			free_sums(s);
7f5a2e
+			close(fd);
7f5a2e
+			if (protocol_version >= 30)
7f5a2e
+				send_msg_int(MSG_NO_SEND, ndx);
7f5a2e
+			continue;
7f5a2e
+		}
7f5a2e
+
7f5a2e
 		if (IS_DEVICE(st.st_mode) && st.st_size == 0)
7f5a2e
 			st.st_size = get_device_size(fd, fname);
7f5a2e