Need to output the "failed verification" error before sending the
[rsync/rsync.git] / receiver.c
index fcde60f..50fe2e5 100644 (file)
@@ -552,13 +552,25 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
                cleanup_disable();
 
                if (!recv_ok) {
-                       if (csum_length == SUM_LENGTH) {
-                               rprintf(FERROR,"ERROR: file corruption in %s. File changed during transfer?\n",
-                                       full_fname(fname));
-                       } else {
+                       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];
-                               if (verbose > 1)
-                                       rprintf(FINFO,"redoing %s(%d)\n",fname,i);
                                SIVAL(buf, 0, i);
                                send_msg(MSG_REDO, buf, 4);
                        }