Fixed failing hunks.
[rsync/rsync-patches.git] / threaded-receiver.diff
index f219a94..9b355d2 100644 (file)
@@ -137,7 +137,7 @@ After applying this patch, run these commands for a successful build:
                                continue;
                }
  
-@@ -1175,7 +1179,7 @@ static void recv_generator(char *fname, 
+@@ -1184,7 +1188,7 @@ static void recv_generator(char *fname, 
                return;
        }
  
@@ -146,7 +146,7 @@ After applying this patch, run these commands for a successful build:
                return;
  
        if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
-@@ -1230,7 +1234,7 @@ static void recv_generator(char *fname, 
+@@ -1239,7 +1243,7 @@ static void recv_generator(char *fname, 
                goto notify_others;
        }
  
@@ -155,7 +155,7 @@ After applying this patch, run these commands for a successful build:
                if (!(backupptr = get_backup_name(fname))) {
                        close(fd);
                        return;
-@@ -1321,9 +1325,12 @@ void generate_files(int f_out, struct fi
+@@ -1330,9 +1334,12 @@ void generate_files(int f_out, struct fi
        int save_ignore_existing = ignore_existing;
        int save_ignore_non_existing = ignore_non_existing;
        int save_do_progress = do_progress;
@@ -169,7 +169,7 @@ After applying this patch, run these commands for a successful build:
        if (protocol_version >= 29) {
                itemizing = 1;
                maybe_ATTRS_REPORT = log_format_has_i ? 0 : ATTRS_REPORT;
-@@ -1351,7 +1358,7 @@ void generate_files(int f_out, struct fi
+@@ -1360,7 +1367,7 @@ void generate_files(int f_out, struct fi
                do_delete_pass(flist);
        do_progress = 0;
  
@@ -178,7 +178,7 @@ After applying this patch, run these commands for a successful build:
                whole_file = 0;
        if (verbose >= 2) {
                rprintf(FINFO, "delta-transmission %s\n",
-@@ -1360,12 +1367,6 @@ void generate_files(int f_out, struct fi
+@@ -1369,12 +1376,6 @@ void generate_files(int f_out, struct fi
                        : "enabled");
        }
  
@@ -191,7 +191,7 @@ After applying this patch, run these commands for a successful build:
        for (i = 0; i < flist->count; i++) {
                struct file_struct *file = flist->files[i];
  
-@@ -1409,23 +1410,34 @@ void generate_files(int f_out, struct fi
+@@ -1418,23 +1419,34 @@ void generate_files(int f_out, struct fi
                delete_in_dir(NULL, NULL, NULL, NULL);
  
        phase++;
@@ -232,7 +232,7 @@ After applying this patch, run these commands for a successful build:
                if (local_name)
                        strlcpy(fbuf, local_name, sizeof fbuf);
                else
-@@ -1437,27 +1449,43 @@ void generate_files(int f_out, struct fi
+@@ -1446,27 +1458,43 @@ void generate_files(int f_out, struct fi
        phase++;
        ignore_non_existing = save_ignore_non_existing;
        ignore_existing = save_ignore_existing;
@@ -460,7 +460,7 @@ After applying this patch, run these commands for a successful build:
  static void read_msg_fd(void)
  {
        char buf[2048];
-@@ -244,57 +242,6 @@ static void read_msg_fd(void)
+@@ -244,58 +242,6 @@ static void read_msg_fd(void)
        tag = (tag >> 24) - MPLEX_BASE;
  
        switch (tag) {
@@ -514,15 +514,17 @@ After applying this patch, run these commands for a successful build:
 -                      exit_cleanup(RERR_STREAMIO);
 -              }
 -              close_multiplexing_out();
+-              defer_forwarding_messages = 0;
 -              /* FALL THROUGH */
        case MSG_INFO:
        case MSG_ERROR:
        case MSG_LOG:
-@@ -303,10 +250,7 @@ static void read_msg_fd(void)
+@@ -304,11 +250,7 @@ static void read_msg_fd(void)
                        if (n >= sizeof buf)
                                n = sizeof buf - 1;
                        read_loop(fd, buf, n);
--                      if (am_generator && am_server && defer_forwarding_messages)
+-                      if (am_generator && am_server
+-                       && defer_forwarding_messages && tag != MSG_LOG)
 -                              msg_list_add(&msg2sndr, tag, buf, n);
 -                      else
 -                              rwrite((enum logcode)tag, buf, n);
@@ -530,7 +532,7 @@ After applying this patch, run these commands for a successful build:
                        len -= n;
                }
                break;
-@@ -341,70 +285,76 @@ void decrement_active_files(int ndx)
+@@ -343,70 +285,76 @@ void decrement_active_files(int ndx)
        active_bytecnt -= the_file_list->files[ndx]->length;
  }
  
@@ -651,7 +653,7 @@ After applying this patch, run these commands for a successful build:
        return flist_ndx_pop(&hlink_list);
  }
  
-@@ -484,11 +434,6 @@ static int read_timeout(int fd, char *bu
+@@ -486,11 +434,6 @@ static int read_timeout(int fd, char *bu
                FD_ZERO(&r_fds);
                FD_ZERO(&w_fds);
                FD_SET(fd, &r_fds);
@@ -663,7 +665,7 @@ After applying this patch, run these commands for a successful build:
                if (io_filesfrom_f_out >= 0) {
                        int new_fd;
                        if (io_filesfrom_buflen == 0) {
-@@ -521,9 +466,6 @@ static int read_timeout(int fd, char *bu
+@@ -523,9 +466,6 @@ static int read_timeout(int fd, char *bu
                        continue;
                }
  
@@ -673,7 +675,7 @@ After applying this patch, run these commands for a successful build:
                if (io_filesfrom_f_out >= 0) {
                        if (io_filesfrom_buflen) {
                                if (FD_ISSET(io_filesfrom_f_out, &w_fds)) {
-@@ -845,6 +787,8 @@ static void readfd(int fd, char *buffer,
+@@ -847,6 +787,8 @@ static void readfd(int fd, char *buffer,
        }
  
        if (fd == write_batch_monitor_in) {
@@ -682,7 +684,7 @@ After applying this patch, run these commands for a successful build:
                if ((size_t)write(batch_fd, buffer, total) != total)
                        exit_cleanup(RERR_FILEIO);
        }
-@@ -1106,7 +1050,6 @@ static void writefd_unbuffered(int fd,ch
+@@ -1108,7 +1050,6 @@ static void writefd_unbuffered(int fd,ch
                         * to grab any messages they sent before they died. */
                        while (fd == sock_f_out && io_multiplexing_in) {
                                set_io_timeout(30);
@@ -690,7 +692,7 @@ After applying this patch, run these commands for a successful build:
                                readfd_unbuffered(sock_f_in, io_filesfrom_buf,
                                                  sizeof io_filesfrom_buf);
                        }
-@@ -1117,7 +1060,7 @@ static void writefd_unbuffered(int fd,ch
+@@ -1119,7 +1060,7 @@ static void writefd_unbuffered(int fd,ch
                defer_forwarding_messages = 1;
  
                if (fd == sock_f_out) {
@@ -699,7 +701,7 @@ After applying this patch, run these commands for a successful build:
                                last_io_out = time(NULL);
                        sleep_for_bwlimit(cnt);
                }
-@@ -1127,23 +1070,6 @@ static void writefd_unbuffered(int fd,ch
+@@ -1129,32 +1070,6 @@ static void writefd_unbuffered(int fd,ch
        no_flush--;
  }
  
@@ -710,11 +712,20 @@ After applying this patch, run these commands for a successful build:
 -
 -      while (msg2sndr.head && io_multiplexing_out) {
 -              struct msg_list_item *m = msg2sndr.head;
+-              int tag = *((uchar*)m->buf+3) - MPLEX_BASE;
 -              if (!(msg2sndr.head = m->next))
 -                      msg2sndr.tail = NULL;
--              stats.total_written += m->len;
 -              defer_forwarding_messages = 1;
--              writefd_unbuffered(sock_f_out, m->buf, m->len);
+-              switch (tag) {
+-              case MSG_INFO:
+-              case MSG_ERROR:
+-                      rwrite((enum logcode)tag, m->buf + 4, m->len - 4);
+-                      break;
+-              default:
+-                      stats.total_written += m->len;
+-                      writefd_unbuffered(sock_f_out, m->buf, m->len);
+-                      break;
+-              }
 -              defer_forwarding_messages = 0;
 -              free(m);
 -      }
@@ -723,7 +734,7 @@ After applying this patch, run these commands for a successful build:
  /**
   * Write an message to a multiplexed stream. If this fails then rsync
   * exits.
-@@ -1169,14 +1095,15 @@ static void mplex_write(enum msgcode cod
+@@ -1180,14 +1095,15 @@ static void mplex_write(enum msgcode cod
                defer_forwarding_messages = 1;
                writefd_unbuffered(sock_f_out, buf, len);
                defer_forwarding_messages = 0;
@@ -742,7 +753,7 @@ After applying this patch, run these commands for a successful build:
  
        if (!iobuf_out_cnt || no_flush)
                return;
-@@ -1190,11 +1117,6 @@ void io_flush(int flush_it_all)
+@@ -1201,11 +1117,6 @@ void io_flush(int flush_it_all)
  
  static void writefd(int fd,char *buf,size_t len)
  {
@@ -754,7 +765,7 @@ After applying this patch, run these commands for a successful build:
        if (fd == sock_f_out)
                stats.total_written += len;
  
-@@ -1400,9 +1322,3 @@ void start_write_batch(int fd)
+@@ -1411,9 +1322,3 @@ void start_write_batch(int fd)
        else
                write_batch_monitor_in = fd;
  }
@@ -782,7 +793,7 @@ After applying this patch, run these commands for a successful build:
        { RERR_SIGNAL     , "received SIGINT, SIGTERM, or SIGHUP" },
        { RERR_WAITCHILD  , "waitpid() failed" },
        { RERR_MALLOC     , "error allocating core memory buffers" },
-@@ -227,8 +225,8 @@ void rwrite(enum logcode code, char *buf
+@@ -224,8 +222,8 @@ void rwrite(enum logcode code, char *buf
        if (quiet && code == FINFO)
                return;
  
@@ -803,7 +814,7 @@ After applying this patch, run these commands for a successful build:
  extern int am_daemon;
  extern int blocking_io;
  extern int remove_sent_files;
-@@ -87,9 +86,20 @@ struct pid_status {
+@@ -91,9 +90,20 @@ struct pid_status {
  
  static time_t starttime, endtime;
  static int64 total_read, total_written;
@@ -824,7 +835,7 @@ After applying this patch, run these commands for a successful build:
  /* Works like waitpid(), but if we already harvested the child pid in our
   * remember_children(), we succeed instead of returning an error. */
  pid_t wait_process(pid_t pid, int *status_ptr, int flags)
-@@ -166,7 +176,7 @@ static void handle_stats(int f)
+@@ -170,7 +180,7 @@ static void handle_stats(int f)
                show_flist_stats();
        }
  
@@ -833,7 +844,7 @@ After applying this patch, run these commands for a successful build:
                return;
  
        if (am_daemon) {
-@@ -630,12 +640,30 @@ static void do_server_sender(int f_in, i
+@@ -634,12 +644,30 @@ static void do_server_sender(int f_in, i
        exit_cleanup(0);
  }
  
@@ -867,7 +878,7 @@ After applying this patch, run these commands for a successful build:
  
        /* The receiving side mustn't obey this, or an existing symlink that
         * points to an identical file won't be replaced by the referent. */
-@@ -644,70 +672,16 @@ static int do_recv(int f_in,int f_out,st
+@@ -648,70 +676,16 @@ static int do_recv(int f_in,int f_out,st
        if (preserve_hard_links)
                init_hard_links();
  
@@ -943,7 +954,7 @@ After applying this patch, run these commands for a successful build:
        generate_files(f_out, flist, local_name);
  
        handle_stats(-1);
-@@ -718,10 +692,13 @@ static int do_recv(int f_in,int f_out,st
+@@ -722,10 +696,13 @@ static int do_recv(int f_in,int f_out,st
        }
        io_flush(FULL_FLUSH);
  
@@ -961,7 +972,7 @@ After applying this patch, run these commands for a successful build:
  }
  
  
-@@ -1091,22 +1068,6 @@ static int start_client(int argc, char *
+@@ -1103,22 +1080,6 @@ static int start_client(int argc, char *
        return ret;
  }
  
@@ -984,7 +995,7 @@ After applying this patch, run these commands for a successful build:
  RETSIGTYPE remember_children(UNUSED(int val))
  {
  #ifdef WNOHANG
-@@ -1198,8 +1159,6 @@ int main(int argc,char *argv[])
+@@ -1210,8 +1171,6 @@ int main(int argc,char *argv[])
  # endif
        sigact.sa_flags = SA_NOCLDSTOP;
  #endif
@@ -1049,7 +1060,7 @@ After applying this patch, run these commands for a successful build:
  int keep_partial = 0;
  int safe_symlinks = 0;
  int copy_unsafe_links = 0;
-@@ -1300,6 +1300,7 @@ int parse_arguments(int *argc, const cha
+@@ -1294,6 +1294,7 @@ int parse_arguments(int *argc, const cha
  
        if (do_progress && !verbose && !log_before_transfer && !am_server)
                verbose = 1;
@@ -1237,7 +1248,7 @@ After applying this patch, run these commands for a successful build:
  
 --- old/util.c
 +++ new/util.c
-@@ -410,49 +410,6 @@ int robust_rename(char *from, char *to, 
+@@ -415,49 +415,6 @@ int robust_rename(char *from, char *to, 
        return -1;
  }