Fix --only-write-batch hang with --hard-links.
authorWayne Davison <wayned@samba.org>
Sat, 28 Jan 2012 19:51:28 +0000 (11:51 -0800)
committerWayne Davison <wayned@samba.org>
Sat, 28 Jan 2012 20:04:26 +0000 (12:04 -0800)
Fixes bug 8565.

generator.c
hlink.c
receiver.c

index c44ba3b..973e03b 100644 (file)
@@ -81,6 +81,7 @@ extern int link_dest;
 extern int whole_file;
 extern int list_only;
 extern int read_batch;
+extern int write_batch;
 extern int safe_symlinks;
 extern long block_size; /* "long" because popt can't set an int32. */
 extern int unsort_ndx;
@@ -1813,7 +1814,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
   notify_others:
        if (remove_source_files && !delay_updates && !phase && !dry_run)
                increment_active_files(ndx, itemizing, code);
-       if (inc_recurse && !dry_run)
+       if (inc_recurse && (!dry_run || write_batch < 0))
                cur_flist->in_progress++;
 #ifdef SUPPORT_HARD_LINKS
        if (preserve_hard_links && F_IS_HLINKED(file))
diff --git a/hlink.c b/hlink.c
index 0e61d5a..f192e3a 100644 (file)
--- a/hlink.c
+++ b/hlink.c
@@ -496,7 +496,7 @@ void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
        int prev_statret, ndx, prev_ndx = F_HL_PREV(file);
 
        if (stp == NULL && prev_ndx >= 0) {
-               if (link_stat(fname, &st, 0) < 0) {
+               if (link_stat(fname, &st, 0) < 0 && !dry_run) {
                        rsyserr(FERROR_XFER, errno, "stat %s failed",
                                full_fname(fname));
                        return;
index 3ab893d..ddcb55f 100644 (file)
@@ -681,6 +681,8 @@ int recv_files(int f_in, int f_out, char *local_name)
                        log_item(FCLIENT, file, iflags, NULL);
                        if (!am_server)
                                discard_receive_data(f_in, F_LENGTH(file));
+                       if (inc_recurse)
+                               send_msg_int(MSG_SUCCESS, ndx);
                        continue;
                }