Don't try to delete when list_only is set.
[rsync/rsync.git] / generator.c
index 8f46d40..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,7 +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;
-extern int unsort_ndx;
 
 int ignore_perishable = 0;
 int non_perishable_cnt = 0;
@@ -1427,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
@@ -2040,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) {