Need to make sure that the destination file doesn't exist before we
[rsync/rsync-patches.git] / compare-dest.diff
index 975edf5..cdb9356 100644 (file)
@@ -9,9 +9,9 @@ they are suppled).
 
 Before compiling, be sure to run "make proto".
 
---- orig/generator.c   2004-07-30 07:18:03
+--- orig/generator.c   2004-09-20 19:57:58
 +++ generator.c        2004-07-30 07:28:13
-@@ -43,7 +43,7 @@ extern int io_timeout;
+@@ -45,7 +45,7 @@ extern int io_timeout;
  extern int protocol_version;
  extern int always_checksum;
  extern char *partial_dir;
@@ -20,7 +20,7 @@ Before compiling, be sure to run "make proto".
  extern int link_dest;
  extern int whole_file;
  extern int local_server;
-@@ -419,11 +419,19 @@ static void recv_generator(char *fname, 
+@@ -426,11 +426,19 @@ static void recv_generator(char *fname, 
        fnamecmp = fname;
        fnamecmp_type = G2R_FNAME;
  
@@ -44,7 +44,7 @@ Before compiling, be sure to run "make proto".
  #if HAVE_LINK
                        if (link_dest && !dry_run) {
                                if (do_link(fnamecmpbuf, fname) < 0) {
-@@ -434,15 +442,14 @@ static void recv_generator(char *fname, 
+@@ -441,15 +449,14 @@ static void recv_generator(char *fname, 
                                                        safe_fname(fname));
                                        }
                                        fnamecmp = fnamecmpbuf;
@@ -82,8 +82,8 @@ Before compiling, be sure to run "make proto".
  
        /* The receiving side mustn't obey this, or an existing symlink that
         * points to an identical file won't be replaced by the referent. */
---- orig/options.c     2004-08-11 23:42:23
-+++ options.c  2004-08-12 00:02:57
+--- orig/options.c     2004-09-20 05:10:48
++++ options.c  2004-08-13 07:55:37
 @@ -114,12 +114,13 @@ int write_batch = 0;
  int read_batch = 0;
  int backup_dir_len = 0;
@@ -127,7 +127,7 @@ Before compiling, be sure to run "make proto".
    /* TODO: Should this take an optional int giving the compression level? */
    {"compress",        'z', POPT_ARG_NONE,   &do_compression, 0, 0, 0 },
    {"daemon",           0,  POPT_ARG_NONE,   &daemon_opt, 0, 0, 0 },
-@@ -609,8 +611,28 @@ int parse_arguments(int *argc, const cha
+@@ -605,8 +607,28 @@ int parse_arguments(int *argc, const cha
                                select_timeout = io_timeout;
                        break;
  
@@ -156,7 +156,7 @@ Before compiling, be sure to run "make proto".
                        link_dest = 1;
                        break;
  #else
-@@ -703,6 +725,11 @@ int parse_arguments(int *argc, const cha
+@@ -699,6 +721,11 @@ int parse_arguments(int *argc, const cha
                return 0;
        }
  
@@ -168,7 +168,7 @@ Before compiling, be sure to run "make proto".
        if (archive_mode) {
                if (!files_from)
                        recurse = 1;
-@@ -733,8 +760,6 @@ int parse_arguments(int *argc, const cha
+@@ -729,8 +756,6 @@ int parse_arguments(int *argc, const cha
                        tmpdir = sanitize_path(NULL, tmpdir, NULL, 0);
                if (partial_dir)
                        partial_dir = sanitize_path(NULL, partial_dir, NULL, 0);
@@ -177,7 +177,28 @@ Before compiling, be sure to run "make proto".
                if (backup_dir)
                        backup_dir = sanitize_path(NULL, backup_dir, NULL, 0);
                if (files_from)
-@@ -884,8 +909,8 @@ int parse_arguments(int *argc, const cha
+@@ -738,6 +763,7 @@ int parse_arguments(int *argc, const cha
+       }
+       if (server_exclude_list.head && !am_sender) {
+               struct exclude_list_struct *elp = &server_exclude_list;
++              int i;
+               if (tmpdir) {
+                       clean_fname(tmpdir, 1);
+                       if (check_exclude(elp, tmpdir, 1) < 0)
+@@ -748,9 +774,9 @@ int parse_arguments(int *argc, const cha
+                       if (check_exclude(elp, partial_dir, 1) < 0)
+                               goto options_rejected;
+               }
+-              if (compare_dest) {
+-                      clean_fname(compare_dest, 1);
+-                      if (check_exclude(elp, compare_dest, 1) < 0)
++              for (i = 0; i < num_comp_dest; i++) {
++                      clean_fname(compare_dest[i], 1);
++                      if (check_exclude(elp, compare_dest[i], 1) < 0)
+                               goto options_rejected;
+               }
+               if (backup_dir) {
+@@ -890,8 +916,8 @@ int parse_arguments(int *argc, const cha
   **/
  void server_options(char **args,int *argc)
  {
@@ -187,7 +208,7 @@ Before compiling, be sure to run "make proto".
        char *arg;
  
        int i, x;
-@@ -1069,13 +1094,16 @@ void server_options(char **args,int *arg
+@@ -1074,13 +1100,16 @@ void server_options(char **args,int *arg
                args[ac++] = tmpdir;
        }
  
@@ -207,7 +228,7 @@ Before compiling, be sure to run "make proto".
        }
  
        if (files_from && (!am_sender || remote_filesfrom_file)) {
---- orig/receiver.c    2004-07-30 07:17:48
+--- orig/receiver.c    2004-09-07 21:57:20
 +++ receiver.c 2004-07-30 07:31:12
 @@ -38,7 +38,7 @@ extern int cvs_exclude;
  extern int io_error;
@@ -218,7 +239,7 @@ Before compiling, be sure to run "make proto".
  extern int make_backups;
  extern int do_progress;
  extern char *backup_dir;
-@@ -442,7 +442,8 @@ int recv_files(int f_in, struct file_lis
+@@ -438,7 +438,8 @@ int recv_files(int f_in, struct file_lis
                partialptr = partial_dir ? partial_dir_fname(fname) : fname;
  
                if (f_in_name >= 0) {
@@ -228,7 +249,7 @@ Before compiling, be sure to run "make proto".
                        case G2R_FNAME:
                                fnamecmp = fname;
                                break;
-@@ -451,7 +452,7 @@ int recv_files(int f_in, struct file_lis
+@@ -450,7 +451,7 @@ int recv_files(int f_in, struct file_lis
                                break;
                        default:
                                pathjoin(fnamecmpbuf, sizeof fnamecmpbuf,
@@ -237,7 +258,7 @@ Before compiling, be sure to run "make proto".
                                fnamecmp = fnamecmpbuf;
                                break;
                        }
---- orig/rsync.h       2004-07-30 07:16:38
+--- orig/rsync.h       2004-09-07 21:52:22
 +++ rsync.h    2004-07-30 07:23:54
 @@ -98,6 +98,8 @@