X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/95a38e8684439082bd86a988e593939e10172881..ec0e5ac001843c24d58073447842c2b89b38bf96:/flist.c diff --git a/flist.c b/flist.c index 894cf16c..d438400a 100644 --- a/flist.c +++ b/flist.c @@ -43,6 +43,7 @@ extern int preserve_gid; extern int preserve_times; extern int relative_paths; extern int copy_links; +extern int remote_version; static char **local_exclude_list = NULL; @@ -142,10 +143,14 @@ void send_file_entry_v11(struct file_struct *file,int f) write_int(f,(int)file->modtime); if (!(flags & SAME_MODE)) write_int(f,(int)file->mode); - if (preserve_uid && !(flags & SAME_UID)) - write_int(f,(int)file->uid); - if (preserve_gid && !(flags & SAME_GID)) - write_int(f,(int)file->gid); + if (preserve_uid && !(flags & SAME_UID)) { + add_uid(file->uid); + write_int(f,(int)file->uid); + } + if (preserve_gid && !(flags & SAME_GID)) { + add_gid(file->gid); + write_int(f,(int)file->gid); + } if (preserve_devices && IS_DEVICE(file->mode) && !(flags & SAME_RDEV)) write_int(f,(int)file->rdev); @@ -502,6 +507,11 @@ struct file_list *send_file_list(int f,int argc,char *argv[]) clean_flist(flist); + /* now send the uid/gid list. This was introduced in protocol version 15 */ + if (f != -1 && remote_version >= 15) { + send_uid_list(f); + } + return flist; } @@ -564,6 +574,11 @@ struct file_list *recv_file_list(int f) fprintf(FINFO,"done\n"); } + /* now recv the uid/gid list. This was introduced in protocol version 15 */ + if (f != -1 && remote_version >= 15) { + recv_uid_list(f, flist); + } + return flist; oom: @@ -581,16 +596,6 @@ int file_compare(struct file_struct *f1,struct file_struct *f2) } -/* we need this function because of the silly way in which duplicate - entries are handled in the file lists - we can't change this - without breaking existing versions */ -static int flist_up(struct file_list *flist, int i) -{ - while (!flist->files[i].name) i++; - return i; -} - - int flist_find(struct file_list *flist,struct file_struct *f) { int low=0,high=flist->count-1;