X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/23e43fceeb918374e99005c7d1553ded436d6bab..2b6b4d539b0aab98b1cbb9d8c639cb12473aae94:/rsync.c diff --git a/rsync.c b/rsync.c index 6644f141..1621995b 100644 --- a/rsync.c +++ b/rsync.c @@ -267,6 +267,7 @@ static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, { int updated = 0; STRUCT_STAT st2; + extern int am_daemon; if (dry_run) return 0; @@ -300,8 +301,9 @@ static int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, } #endif - if ((am_root && preserve_uid && st->st_uid != file->uid) || - (preserve_gid && st->st_gid != file->gid)) { + if ((am_root || !am_daemon) && + ((am_root && preserve_uid && st->st_uid != file->uid) || + (preserve_gid && st->st_gid != file->gid))) { if (do_lchown(fname, (am_root&&preserve_uid)?file->uid:-1, preserve_gid?file->gid:-1) != 0) { @@ -694,7 +696,8 @@ static void delete_files(struct file_list *flist) if (!S_ISDIR(flist->files[j]->mode) || !(flist->files[j]->flags & FLAG_DELETE)) continue; - if (delete_already_done(flist, j)) continue; + if (remote_version < 19 && + delete_already_done(flist, j)) continue; name = strdup(f_name(flist->files[j])); @@ -708,7 +711,8 @@ static void delete_files(struct file_list *flist) for (i=local_file_list->count-1;i>=0;i--) { if (!local_file_list->files[i]->basename) continue; - if (S_ISDIR(local_file_list->files[i]->mode)) + if (remote_version < 19 && + S_ISDIR(local_file_list->files[i]->mode)) add_delete_entry(local_file_list->files[i]); if (-1 == flist_find(flist,local_file_list->files[i])) { delete_one(local_file_list->files[i]);