Improved the progress_is_active code to not overwrite the progress
[rsync/rsync.git] / rsync.c
diff --git a/rsync.c b/rsync.c
index c384ed9..85244c8 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -207,8 +207,9 @@ int iconvbufs(iconv_t ic, xbuf *in, xbuf *out, int flags)
 
 void send_protected_args(int fd, char *args[])
 {
+       int i;
 #ifdef ICONV_OPTION
-       int i, convert = ic_send != (iconv_t)-1;
+       int convert = ic_send != (iconv_t)-1;
        xbuf outbuf, inbuf;
 
        if (convert)
@@ -560,8 +561,12 @@ int finish_transfer(const char *fname, const char *fnametmp,
                goto do_set_file_attrs;
        }
 
-       if (make_backups > 0 && overwriting_basis && !make_backup(fname))
-               return 1;
+       if (make_backups > 0 && overwriting_basis) {
+               if (!make_backup(fname))
+                       return 1;
+               if (fnamecmp == fname)
+                       fnamecmp = get_backup_name(fname);
+       }
 
        /* Change permissions before putting the file into place. */
        set_file_attrs(fnametmp, file, NULL, fnamecmp,