X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/0607c30700f1f7e80ecf723ec24a3127ef158596..7bc595785ee6ac59fe514fd84ddc6d3a3c44e587:/generator.c diff --git a/generator.c b/generator.c index 2d5bd128..10500a99 100644 --- a/generator.c +++ b/generator.c @@ -27,7 +27,6 @@ extern int dry_run; extern int do_xfers; extern int stdout_format_has_i; extern int logfile_format_has_i; -extern int receiver_symlink_times; extern int am_root; extern int am_server; extern int am_daemon; @@ -280,7 +279,7 @@ static enum delret delete_dir_contents(char *fname, uint16 flags) for (j = dirlist->used; j--; ) { struct file_struct *fp = dirlist->files[j]; - if (fp->flags & FLAG_MOUNT_DIR) { + if (fp->flags & FLAG_MOUNT_DIR && S_ISDIR(fp->mode)) { if (verbose > 1) { rprintf(FINFO, "mount point, %s, pins parent directory\n", @@ -512,7 +511,7 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev) struct file_struct *fp = dirlist->files[i]; if (!F_IS_ACTIVE(fp)) continue; - if (fp->flags & FLAG_MOUNT_DIR) { + if (fp->flags & FLAG_MOUNT_DIR && S_ISDIR(fp->mode)) { if (verbose > 1) rprintf(FINFO, "cannot delete mount point: %s\n", f_name(fp, NULL)); @@ -1359,6 +1358,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, && !am_root && sx.st.st_uid == our_uid) del_opts |= DEL_NO_UID_WRITE; + if (ignore_existing > 0 && statret == 0 + && (!is_dir || !S_ISDIR(sx.st.st_mode))) { + if (verbose > 1 && is_dir >= 0) + rprintf(FINFO, "%s exists\n", fname); + goto cleanup; + } + if (is_dir) { if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR) goto cleanup; @@ -1664,12 +1670,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } - if (ignore_existing > 0 && statret == 0) { - if (verbose > 1) - rprintf(FINFO, "%s exists\n", fname); - goto cleanup; - } - if (update_only > 0 && statret == 0 && cmp_time(sx.st.st_mtime, file->modtime) > 0) { if (verbose > 1) @@ -1743,9 +1743,6 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } - if (append_mode > 0 && sx.st.st_size >= F_LENGTH(file)) - goto cleanup; - if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH) ; else if (fnamecmp_type == FNAMECMP_FUZZY) @@ -1770,6 +1767,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, goto cleanup; } + if (append_mode > 0 && sx.st.st_size >= F_LENGTH(file)) { + goto cleanup; + } + prepare_to_open: if (partialptr) { sx.st = partial_st; @@ -1857,7 +1858,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, rprintf(FINFO, "generating and sending sums for %d\n", ndx); notify_others: - if (remove_source_files && !delay_updates && !phase) + if (remove_source_files && !delay_updates && !phase && !dry_run) increment_active_files(ndx, itemizing, code); if (inc_recurse && !dry_run) cur_flist->in_progress++; @@ -2081,7 +2082,7 @@ void generate_files(int f_out, const char *local_name) need_retouch_dir_times = preserve_times > 1; lull_mod = allowed_lull * 5; symlink_timeset_failed_flags = ITEM_REPORT_TIME - | (receiver_symlink_times ? ITEM_REPORT_TIMEFAIL : 0 ); + | (protocol_version >= 30 || !am_server ? ITEM_REPORT_TIMEFAIL : 0); if (verbose > 2) rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());