- Changed the map_size parameter to map_file() to be an int32 named
[rsync/rsync.git] / generator.c
index ce93b5a..2ffd03f 100644 (file)
@@ -47,7 +47,7 @@ extern int protocol_version;
 extern int always_checksum;
 extern char *partial_dir;
 extern char *basis_dir[];
-extern int copy_dest;
+extern int compare_dest;
 extern int link_dest;
 extern int whole_file;
 extern int local_server;
@@ -467,13 +467,13 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                                                        safe_fname(fname));
                                        }
                                        fnamecmp = fnamecmpbuf;
-                                       fnamecmp_type = FNAMECMP_BASIS_DIR + i;
+                                       fnamecmp_type = i;
                                }
                        } else
 #endif
                        {
                                fnamecmp = fnamecmpbuf;
-                               fnamecmp_type = FNAMECMP_BASIS_DIR + i;
+                               fnamecmp_type = i;
                        }
                }
        }
@@ -485,7 +485,7 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                stat_errno = ENOENT;
        }
 
-       if (partial_dir && (partialptr = partial_dir_fname(fname))
+       if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
            && link_stat(partialptr, &partial_st, 0) == 0
            && S_ISREG(partial_st.st_mode)) {
                if (statret == -1)
@@ -519,7 +519,7 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
                return;
        }
 
-       if ((link_dest || copy_dest) && fnamecmp_type != FNAMECMP_FNAME)
+       if (!compare_dest && fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
                ;
        else if (unchanged_file(fnamecmp, file, &st)) {
                if (fnamecmp_type == FNAMECMP_FNAME)
@@ -528,6 +528,13 @@ static void recv_generator(char *fname, struct file_struct *file, int i,
        }
 
 prepare_to_open:
+       if (partialptr) {
+               st = partial_st;
+               fnamecmp = partialptr;
+               fnamecmp_type = FNAMECMP_PARTIAL_DIR;
+               statret = 0;
+       }
+
        if (dry_run || whole_file > 0) {
                statret = -1;
                goto notify_others;
@@ -535,12 +542,6 @@ prepare_to_open:
        if (read_batch)
                goto notify_others;
 
-       if (partialptr) {
-               st = partial_st;
-               fnamecmp = partialptr;
-               fnamecmp_type = FNAMECMP_PARTIAL_DIR;
-       }
-
        /* open the file */
        fd = do_open(fnamecmp, O_RDONLY, 0);