X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/d62bcc17f303f30d1e3df1051b1390202a21cf9c..7e5614383d07df443ca1170360277205d1721137:/generator.c diff --git a/generator.c b/generator.c index 01cba43c..93587f6c 100644 --- a/generator.c +++ b/generator.c @@ -26,6 +26,7 @@ extern int verbose; extern int dry_run; extern int relative_paths; +extern int keep_dirlinks; extern int preserve_links; extern int am_root; extern int preserve_devices; @@ -52,6 +53,8 @@ extern int only_existing; extern int orig_umask; extern int safe_symlinks; +extern struct exclude_list_struct server_exclude_list; + /* choose whether to skip a particular file */ static int skip_file(char *fname, struct file_struct *file, STRUCT_STAT *st) @@ -281,11 +284,22 @@ void recv_generator(char *fname, struct file_struct *file, int i, int f_out) if (verbose > 2) rprintf(FINFO,"recv_generator(%s,%d)\n",fname,i); - statret = link_stat(fname,&st); + if (server_exclude_list.head + && check_exclude(&server_exclude_list, fname, + S_ISDIR(file->mode)) < 0) { + if (verbose) { + rprintf(FINFO, "skipping server-excluded file \"%s\"\n", + fname); + } + return; + } + + statret = link_stat(fname, &st, keep_dirlinks && S_ISDIR(file->mode)); if (only_existing && statret == -1 && errno == ENOENT) { /* we only want to update existing files */ - if (verbose > 1) rprintf(FINFO, "not creating new file \"%s\"\n",fname); + if (verbose > 1) + rprintf(FINFO, "not creating new file \"%s\"\n", fname); return; } @@ -325,9 +339,10 @@ void recv_generator(char *fname, struct file_struct *file, int i, int f_out) full_fname(fname)); } } - /* f_out is set to -1 when doing final directory - permission and modification time repair */ - if (set_perms(fname,file,NULL,0) && verbose && (f_out != -1)) + /* f_out is set to -1 when doing final directory-permission + * and modification-time repair. */ + if (set_perms(fname, file, statret ? NULL : &st, 0) + && verbose && f_out != -1) rprintf(FINFO,"%s/\n",fname); return; } @@ -414,7 +429,7 @@ void recv_generator(char *fname, struct file_struct *file, int i, int f_out) /* try the file at compare_dest instead */ int saveerrno = errno; pathjoin(fnamecmpbuf, sizeof fnamecmpbuf, compare_dest, fname); - statret = link_stat(fnamecmpbuf,&st); + statret = link_stat(fnamecmpbuf, &st, 0); if (!S_ISREG(st.st_mode)) statret = -1; if (statret == -1)