csomh / rpms / rsync

Forked from rpms/rsync 3 years ago
Clone

Blame SOURCES/rsync-3.1.2-remove-symlinks.patch

5e2a8c
diff --git a/sender.c b/sender.c
5e2a8c
index 03e4aadd..9b432ed9 100644
5e2a8c
--- a/sender.c
5e2a8c
+++ b/sender.c
5e2a8c
@@ -32,6 +32,7 @@ extern int logfile_format_has_i;
5e2a8c
 extern int want_xattr_optim;
5e2a8c
 extern int csum_length;
5e2a8c
 extern int append_mode;
5e2a8c
+extern int copy_links;
5e2a8c
 extern int io_error;
5e2a8c
 extern int flist_eof;
5e2a8c
 extern int allowed_lull;
5e2a8c
@@ -138,17 +139,16 @@ void successful_send(int ndx)
5e2a8c
 		return;
5e2a8c
 	f_name(file, fname);
5e2a8c
 
5e2a8c
-	if (do_lstat(fname, &st) < 0) {
5e2a8c
+	if ((copy_links ? do_stat(fname, &st) : do_lstat(fname, &st)) < 0) {
5e2a8c
 		failed_op = "re-lstat";
5e2a8c
 		goto failed;
5e2a8c
 	}
5e2a8c
 
5e2a8c
-	if (S_ISREG(file->mode) /* Symlinks & devices don't need this check: */
5e2a8c
-	 && (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
5e2a8c
+	if (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
5e2a8c
 #ifdef ST_MTIME_NSEC
5e2a8c
 	 || (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC != F_MOD_NSEC(file))
5e2a8c
 #endif
5e2a8c
-	)) {
5e2a8c
+	) {
5e2a8c
 		rprintf(FERROR_XFER, "ERROR: Skipping sender remove for changed file: %s\n", fname);
5e2a8c
 		return;
5e2a8c
 	}