X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/23e43fceeb918374e99005c7d1553ded436d6bab..ea2111d10a10a164334eff3b621ed7e630404345:/rsync.c diff --git a/rsync.c b/rsync.c index 6644f141..555c009a 100644 --- a/rsync.c +++ b/rsync.c @@ -147,7 +147,6 @@ static void send_sums(struct sum_struct *s,int f_out) write_int(f_out,s->sums[i].sum1); write_buf(f_out,s->sums[i].sum2,csum_length); } - write_flush(f_out); } @@ -267,6 +266,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 +300,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) { @@ -526,7 +527,6 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out) write_int(f_out,i); send_sums(s,f_out); - write_flush(f_out); close(fd); if (buf) unmap_file(buf); @@ -694,7 +694,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 +709,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]); @@ -769,7 +771,6 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen) if (verbose > 2) rprintf(FINFO,"recv_files phase=%d\n",phase); write_int(f_gen,-1); - write_flush(f_gen); continue; } break; @@ -968,7 +969,7 @@ void send_files(struct file_list *flist,int f_out,int f_in) if (verbose > 2) rprintf(FINFO,"send_files starting\n"); - setup_nonblocking(f_in,f_out); + setup_readbuffer(f_in); while (1) { i = read_int(f_in); @@ -977,7 +978,6 @@ void send_files(struct file_list *flist,int f_out,int f_in) phase++; csum_length = SUM_LENGTH; write_int(f_out,-1); - write_flush(f_out); if (verbose > 2) rprintf(FINFO,"send_files phase=%d\n",phase); continue; @@ -1059,7 +1059,6 @@ void send_files(struct file_list *flist,int f_out,int f_in) printf("%s\n",fname+offset); match_sums(f_out,s,buf,st.st_size); - write_flush(f_out); if (buf) unmap_file(buf); close(fd); @@ -1076,7 +1075,6 @@ void send_files(struct file_list *flist,int f_out,int f_in) match_report(); write_int(f_out,-1); - write_flush(f_out); } @@ -1116,7 +1114,6 @@ void generate_files(int f,struct file_list *flist,char *local_name,int f_recv) rprintf(FINFO,"generate_files phase=%d\n",phase); write_int(f,-1); - write_flush(f); /* we expect to just sit around now, so don't exit on a timeout. If we really get a timeout then the other process should exit */ @@ -1136,7 +1133,6 @@ void generate_files(int f,struct file_list *flist,char *local_name,int f_recv) rprintf(FINFO,"generate_files phase=%d\n",phase); write_int(f,-1); - write_flush(f); }