Don't try to delete when list_only is set.
[rsync/rsync.git] / generator.c
index 24435ea..3804118 100644 (file)
@@ -84,6 +84,7 @@ extern int list_only;
 extern int read_batch;
 extern int safe_symlinks;
 extern long block_size; /* "long" because popt can't set an int32. */
+extern int unsort_ndx;
 extern int max_delete;
 extern int force_delete;
 extern int one_file_system;
@@ -95,9 +96,6 @@ extern char *backup_suffix;
 extern int backup_suffix_len;
 extern struct file_list *cur_flist, *first_flist, *dir_flist;
 extern struct filter_list_struct server_filter_list;
-#ifdef ICONV_OPTION
-extern int ic_ndx;
-#endif
 
 int ignore_perishable = 0;
 int non_perishable_cnt = 0;
@@ -517,6 +515,14 @@ static void do_delete_pass(void)
 
 int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
 {
+#ifndef HAVE_LUTIMES
+       if (S_ISLNK(file->mode)) {
+               ;
+       } else
+#endif
+       if (preserve_times && cmp_time(sxp->st.st_mtime, file->modtime) != 0)
+               return 0;
+
        if (preserve_perms && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
                return 0;
 
@@ -895,9 +901,6 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
                case 2:
                        if (!unchanged_attrs(cmpbuf, file, sxp))
                                continue;
-                       if (always_checksum > 0 && preserve_times
-                        && cmp_time(sxp->st.st_mtime, file->modtime))
-                               continue;
                        best_match = j;
                        match_level = 3;
                        break;
@@ -1424,7 +1427,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                                set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT);
                                if (itemizing)
                                        itemize(fname, file, ndx, 0, &sx, 0, 0, NULL);
-#ifdef SUPPORT_HARD_LINKS
+#if defined SUPPORT_HARD_LINKS && defined CAN_HARDLINK_SYMLINK
                                if (preserve_hard_links && F_IS_HLINKED(file))
                                        finish_hard_link(file, fname, ndx, &sx.st, itemizing, code, -1);
 #endif
@@ -2027,14 +2030,8 @@ void generate_files(int f_out, const char *local_name)
        do {
 #ifdef SUPPORT_HARD_LINKS
                if (preserve_hard_links && inc_recurse) {
-                       while (!flist_eof) {
-                               int cnt = first_flist->prev
-                                       ? first_flist->prev->ndx_end - first_flist->ndx_start + 1
-                                       : first_flist->ndx_end - first_flist->ndx_start + 1;
-                               if (cnt >= FILECNT_LOOKAHEAD/2)
-                                       break;
+                       while (!flist_eof && file_total < FILECNT_LOOKAHEAD/2)
                                wait_for_receiver();
-                       }
                }
 #endif
 
@@ -2043,7 +2040,7 @@ void generate_files(int f_out, const char *local_name)
                        f_name(fp, fbuf);
                        ndx = cur_flist->ndx_start - 1;
                        recv_generator(fbuf, fp, ndx, itemizing, code, f_out);
-                       if (delete_during && dry_run < 2) {
+                       if (delete_during && dry_run < 2 && !list_only) {
                                if (BITS_SETnUNSET(fp->flags, FLAG_CONTENT_DIR, FLAG_MISSING_DIR)) {
                                        dev_t dirdev;
                                        if (one_file_system) {
@@ -2061,11 +2058,9 @@ void generate_files(int f_out, const char *local_name)
                        if (!F_IS_ACTIVE(file))
                                continue;
 
-#ifdef ICONV_OPTION
-                       if (ic_ndx)
+                       if (unsort_ndx)
                                ndx = F_NDX(file);
                        else
-#endif
                                ndx = i + cur_flist->ndx_start;
 
                        if (solo_file)