Handle FES_NO_SEND properly on a hard-linked file.
authorWayne Davison <wayned@samba.org>
Mon, 4 Jul 2011 23:02:12 +0000 (16:02 -0700)
committerWayne Davison <wayned@samba.org>
Mon, 4 Jul 2011 23:13:45 +0000 (16:13 -0700)
Fixes bug 8246.

generator.c
io.c

index e24f20f..631a559 100644 (file)
@@ -2009,10 +2009,16 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
        while (1) {
 #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && (ndx = get_hlink_num()) != -1) {
+                       int send_failed = (ndx == -2);
+                       if (send_failed)
+                               ndx = get_hlink_num();
                        flist = flist_for_ndx(ndx, "check_for_finished_files.1");
                        file = flist->files[ndx - flist->ndx_start];
                        assert(file->flags & FLAG_HLINKED);
-                       finish_hard_link(file, f_name(file, fbuf), ndx, NULL, itemizing, code, -1);
+                       if (send_failed)
+                               handle_skipped_hlink(file, itemizing, code, sock_f_out);
+                       else
+                               finish_hard_link(file, f_name(file, fbuf), ndx, NULL, itemizing, code, -1);
                        flist->in_progress--;
                        continue;
                }
diff --git a/io.c b/io.c
index 63dff83..4fb78aa 100644 (file)
--- a/io.c
+++ b/io.c
@@ -1032,13 +1032,19 @@ static void got_flist_entry_status(enum festatus status, int ndx)
        case FES_SUCCESS:
                if (remove_source_files)
                        send_msg_int(MSG_SUCCESS, ndx);
+               /* FALL THROUGH */
+       case FES_NO_SEND:
+#ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links) {
                        struct file_struct *file = flist->files[ndx - flist->ndx_start];
                        if (F_IS_HLINKED(file)) {
+                               if (status == FES_NO_SEND)
+                                       flist_ndx_push(&hlink_list, -2); /* indicates a failure follows */
                                flist_ndx_push(&hlink_list, ndx);
                                flist->in_progress++;
                        }
                }
+#endif
                break;
        case FES_REDO:
                if (read_batch) {
@@ -1050,8 +1056,6 @@ static void got_flist_entry_status(enum festatus status, int ndx)
                        flist->to_redo++;
                flist_ndx_push(&redo_list, ndx);
                break;
-       case FES_NO_SEND:
-               break;
        }
 }