Fixed failing hunks.
[rsync/rsync-patches.git] / threaded-receiver.diff
index d908d9a..b107ed0 100644 (file)
@@ -18,6 +18,12 @@ NOTE: we still need to duplicate the partial_fname static in util.c!
 If you try this out, please send some email to wayned@samba.org or the rsync
 mailing list with your results, build changes, bug reports, etc.  Thanks!
 
+To use this patch, run these commands for a successful build:
+
+    patch -p1 <patches/threaded-receiver.diff
+    ./configure
+    make
+
 --- old/Makefile.in
 +++ new/Makefile.in
 @@ -7,7 +7,7 @@ exec_prefix=@exec_prefix@
@@ -81,7 +87,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
  extern int protocol_version;
  extern int fuzzy_basis;
  extern int always_checksum;
-@@ -95,6 +94,11 @@ extern struct filter_list_struct server_
+@@ -98,6 +97,11 @@ int non_perishable_cnt = 0;
  
  static int deletion_count = 0; /* used to implement --max-delete */
  
@@ -90,10 +96,10 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
 +static int GEN_make_backups;
 +static int GEN_csum_length;
 +
- /* For calling delete_file() */
- #define DEL_FORCE_RECURSE     (1<<1) /* recurse even w/o --force */
- #define DEL_TERSE             (1<<3)
-@@ -445,8 +449,8 @@ static void sum_sizes_sqroot(struct sum_
+ /* For calling delete_item() and delete_dir_contents(). */
+ #define DEL_RECURSE           (1<<1) /* recurse */
+ #define DEL_DIR_IS_EMPTY      (1<<2) /* internal delete_FUNCTIONS use only */
+@@ -508,8 +512,8 @@ static void sum_sizes_sqroot(struct sum_
        }
  
        if (protocol_version < 27) {
@@ -104,7 +110,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                s2length = SUM_LENGTH;
        } else {
                int32 c;
-@@ -456,7 +460,7 @@ static void sum_sizes_sqroot(struct sum_
+@@ -519,7 +523,7 @@ static void sum_sizes_sqroot(struct sum_
                for (c = blength; (c >>= 1) && b; b--) {}
                /* add a bit, subtract rollsum, round up. */
                s2length = (b + 1 - 32 + 7) / 8; /* --optimize in compiler-- */
@@ -113,7 +119,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                s2length = MIN(s2length, SUM_LENGTH);
        }
  
-@@ -490,7 +494,7 @@ static void generate_and_send_sums(int f
+@@ -553,7 +557,7 @@ static void generate_and_send_sums(int f
        sum_sizes_sqroot(&sum, len);
        write_sum_head(f_out, &sum);
  
@@ -122,7 +128,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                return;
  
        if (len > 0)
-@@ -509,7 +513,7 @@ static void generate_and_send_sums(int f
+@@ -572,7 +576,7 @@ static void generate_and_send_sums(int f
  
                if (f_copy >= 0) {
                        full_write(f_copy, map, n1);
@@ -131,7 +137,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                                continue;
                }
  
-@@ -1205,7 +1209,7 @@ static void recv_generator(char *fname, 
+@@ -1347,7 +1351,7 @@ static void recv_generator(char *fname, 
                return;
        }
  
@@ -140,7 +146,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                return;
  
        if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
-@@ -1268,7 +1272,7 @@ static void recv_generator(char *fname, 
+@@ -1410,7 +1414,7 @@ static void recv_generator(char *fname, 
                goto notify_others;
        }
  
@@ -149,7 +155,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                if (!(backupptr = get_backup_name(fname))) {
                        close(fd);
                        return;
-@@ -1359,9 +1363,12 @@ void generate_files(int f_out, struct fi
+@@ -1501,9 +1505,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;
@@ -163,7 +169,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
        if (protocol_version >= 29) {
                itemizing = 1;
                maybe_ATTRS_REPORT = stdout_format_has_i ? 0 : ATTRS_REPORT;
-@@ -1389,7 +1396,7 @@ void generate_files(int f_out, struct fi
+@@ -1531,7 +1538,7 @@ void generate_files(int f_out, struct fi
                do_delete_pass(flist);
        do_progress = 0;
  
@@ -172,7 +178,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                whole_file = 0;
        if (verbose >= 2) {
                rprintf(FINFO, "delta-transmission %s\n",
-@@ -1398,12 +1405,6 @@ void generate_files(int f_out, struct fi
+@@ -1540,12 +1547,6 @@ void generate_files(int f_out, struct fi
                        : "enabled");
        }
  
@@ -185,7 +191,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
        for (i = 0; i < flist->count; i++) {
                struct file_struct *file = flist->files[i];
  
-@@ -1447,23 +1448,34 @@ void generate_files(int f_out, struct fi
+@@ -1589,23 +1590,34 @@ void generate_files(int f_out, struct fi
                delete_in_dir(NULL, NULL, NULL, NULL);
  
        phase++;
@@ -226,7 +232,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                if (local_name)
                        strlcpy(fbuf, local_name, sizeof fbuf);
                else
-@@ -1475,27 +1487,43 @@ void generate_files(int f_out, struct fi
+@@ -1617,27 +1629,43 @@ void generate_files(int f_out, struct fi
        phase++;
        ignore_non_existing = save_ignore_non_existing;
        ignore_existing = save_ignore_existing;
@@ -854,6 +860,13 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
  
 -      if (fd_pair(error_pipe) < 0) {
 -              rsyserr(FERROR, errno, "pipe failed in do_recv");
+-              exit_cleanup(RERR_IPC);
+-      }
+-
+-      io_flush(NORMAL_FLUSH);
+-
+-      if ((pid = do_fork()) == -1) {
+-              rsyserr(FERROR, errno, "fork failed in do_recv");
 +      args.f_in = f_in;
 +      args.flist = flist;
 +      args.local_name = local_name;
@@ -862,13 +875,6 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
                exit_cleanup(RERR_IPC);
        }
  
--      io_flush(NORMAL_FLUSH);
--
--      if ((pid = do_fork()) == -1) {
--              rsyserr(FERROR, errno, "fork failed in do_recv");
--              exit_cleanup(RERR_IPC);
--      }
--
 -      if (pid == 0) {
 -              close(error_pipe[0]);
 -              if (f_in != f_out)
@@ -1030,7 +1036,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
  int keep_partial = 0;
  int safe_symlinks = 0;
  int copy_unsafe_links = 0;
-@@ -1302,6 +1302,7 @@ int parse_arguments(int *argc, const cha
+@@ -1306,6 +1306,7 @@ int parse_arguments(int *argc, const cha
  
        if (do_progress && !verbose && !log_before_transfer && !am_server)
                verbose = 1;
@@ -1197,7 +1203,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
  }
 --- old/rsync.h
 +++ new/rsync.h
-@@ -169,10 +169,8 @@ enum msgcode {
+@@ -170,10 +170,8 @@ enum msgcode {
        MSG_DATA=0,     /* raw data on the multiplexed stream */
        MSG_ERROR=FERROR, MSG_INFO=FINFO, /* remote logging */
        MSG_LOG=FLOG, MSG_SOCKERR=FSOCKERR, /* sibling logging */
@@ -1208,7 +1214,7 @@ mailing list with your results, build changes, bug reports, etc.  Thanks!
  };
  
  #include "errcode.h"
-@@ -329,6 +327,7 @@ enum msgcode {
+@@ -330,6 +328,7 @@ enum msgcode {
  #endif
  
  #include <assert.h>