Should always call finish_transfer() for inplace handling, just like
[rsync/rsync.git] / receiver.c
index 1fe9733..e50f556 100644 (file)
@@ -544,7 +544,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
                        exit_cleanup(RERR_FILEIO);
                }
 
-               if (recv_ok || keep_partial)
+               if (recv_ok || keep_partial || inplace)
                        finish_transfer(fname, fnametmp, file, recv_ok);
                else
                        do_unlink(fnametmp);
@@ -552,25 +552,27 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
                cleanup_disable();
 
                if (!recv_ok) {
-                       int msgtype;
-                       char *redostr;
+                       int msgtype = csum_length == SUM_LENGTH || read_batch ?
+                               FERROR : FINFO;
+                       if (msgtype == FERROR || verbose) {
+                               char *errstr, *redostr;
+                               char *keptstr = keep_partial || inplace ?
+                                       "retain" : "discard";
+                               if (msgtype == FERROR) {
+                                       errstr = "ERROR";
+                                       redostr = "";
+                               } else {
+                                       errstr = "WARNING";
+                                       redostr = " (will try again)";
+                               }
+                               rprintf(msgtype,
+                                       "%s: %s failed verification -- update %sed%s.\n",
+                                       errstr, fname, keptstr, redostr);
+                       }
                        if (csum_length != SUM_LENGTH) {
                                char buf[4];
                                SIVAL(buf, 0, i);
                                send_msg(MSG_REDO, buf, 4);
-                               msgtype = read_batch ? FERROR : FINFO;
-                               redostr = read_batch ? " Redo doubtful."
-                                                    : " Redo pending.";
-                       } else {
-                               msgtype = FERROR;
-                               redostr = "";
-                       }
-                       if (verbose || read_batch) {
-                               rprintf(msgtype,
-                                       "%s: %s failed verification. Update %sed.%s\n",
-                                       msgtype == FERROR ? "ERROR" : "WARNING",
-                                       fname, keep_partial || inplace ?
-                                       "retain" : "discard", redostr);
                        }
                }
        }