Fix --remove-source-files sanity check w/--copy-links the right way.
authorWayne Davison <wayned@samba.org>
Sat, 16 Mar 2019 16:09:09 +0000 (09:09 -0700)
committerWayne Davison <wayned@samba.org>
Sat, 16 Mar 2019 16:09:09 +0000 (09:09 -0700)
Fixes bug #10494.

sender.c

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