summaryrefslogtreecommitdiff
path: root/generator.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-03-16 17:06:52 -0700
committerWayne Davison <wayned@samba.org>2008-03-16 17:17:38 -0700
commitddaef70cede8b8ed24b084b93208a2353745b1bd (patch)
treec1cc465ffce247fe5454b321d34f2a30a3344ab5 /generator.c
parent2357a51e098d3b0f7ff6dfceac37ea42b3c32338 (diff)
downloadrsync-ddaef70cede8b8ed24b084b93208a2353745b1bd.tar.gz
Make the --ignore-existing option not overwrite a regular file with
a dir/symlink/device/special-file, just like it already refuses to overwrite a non-regular file with a regular file.
Diffstat (limited to 'generator.c')
-rw-r--r--generator.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/generator.c b/generator.c
index 4ec0ac41..909c0f4d 100644
--- a/generator.c
+++ b/generator.c
@@ -1358,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;
@@ -1663,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)