X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/b53136076392ff881a03baff19232aadc4617f92..8458724d2558659cfb5e53443759cac5419b13bf:/flist.c diff --git a/flist.c b/flist.c index 2ec04c88..f7ab5a9c 100644 --- a/flist.c +++ b/flist.c @@ -395,7 +395,7 @@ static int skip_filesystem(char *fname, STRUCT_STAT *st) return (st2.st_dev != filesystem_dev); } -static struct file_struct *make_file(char *fname) +static struct file_struct *make_file(int f, char *fname) { struct file_struct *file; STRUCT_STAT st; @@ -403,6 +403,7 @@ static struct file_struct *make_file(char *fname) char *p; char cleaned_name[MAXPATHLEN]; char linkbuf[MAXPATHLEN]; + extern int delete_excluded; strlcpy(cleaned_name, fname, MAXPATHLEN); cleaned_name[MAXPATHLEN-1] = 0; @@ -428,11 +429,12 @@ static struct file_struct *make_file(char *fname) return NULL; } - if (!match_file_name(fname,&st)) + /* f is set to -1 when calculating deletion file list */ + if (((f != -1) || !delete_excluded) && !match_file_name(fname,&st)) return NULL; if (verbose > 2) - rprintf(FINFO,"make_file(%s)\n",fname); + rprintf(FINFO,"make_file(%d,%s)\n",f,fname); file = (struct file_struct *)malloc(sizeof(*file)); if (!file) out_of_memory("make_file"); @@ -509,7 +511,7 @@ void send_file_name(int f,struct file_list *flist,char *fname, { struct file_struct *file; - file = make_file(fname); + file = make_file(f,fname); if (!file) return; @@ -636,7 +638,16 @@ struct file_list *send_file_list(int f,int argc,char *argv[]) l = strlen(fname); if (l != 1 && fname[l-1] == '/') { - strlcat(fname,".",MAXPATHLEN); + if ((l == 2) && (fname[0] == '.')) { + /* Turn ./ into just . rather than ./. + This was put in to avoid a problem with + rsync -aR --delete from ./ + The send_file_name() below of ./ was + mysteriously preventing deletes */ + fname[1] = 0; + } else { + strlcat(fname,".",MAXPATHLEN); + } } if (link_stat(fname,&st) != 0) {