X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/13a1f7929ed05c652dc1b3eb4489ced01c8616f1..9486289ce452ab82ca8b3f16fae8c2ef5247a923:/exclude.c diff --git a/exclude.c b/exclude.c index a55b2f62..b2831e4a 100644 --- a/exclude.c +++ b/exclude.c @@ -25,7 +25,7 @@ extern int verbose; -static char **exclude_list = NULL; +static char **exclude_list; static int is_regex(char *str) { @@ -42,6 +42,8 @@ static int check_one_exclude(char *name,char *pattern) if (!name[0]) return 0; + if (*pattern == '/' && *name != '/') pattern++; + if (is_regex(pattern)) { if (fnmatch(pattern, name, 0) == 0) return 1; @@ -86,7 +88,7 @@ void add_exclude_list(char *pattern,char ***list) if (strcmp(pattern,"!") == 0) { if (verbose > 2) - fprintf(FERROR,"clearing exclude list\n"); + rprintf(FINFO,"clearing exclude list\n"); while ((len)--) free((*list)[len]); free((*list)); @@ -104,7 +106,7 @@ void add_exclude_list(char *pattern,char ***list) out_of_memory("add_exclude"); if (verbose > 2) - fprintf(FERROR,"add_exclude(%s)\n",pattern); + rprintf(FINFO,"add_exclude(%s)\n",pattern); (*list)[len+1] = NULL; } @@ -121,7 +123,7 @@ char **make_exclude_list(char *fname,char **list1,int fatal) char line[MAXPATHLEN]; if (!f) { if (fatal) { - fprintf(FERROR,"%s : %s\n",fname,strerror(errno)); + rprintf(FERROR,"%s : %s\n",fname,strerror(errno)); exit_cleanup(1); } return list; @@ -163,9 +165,9 @@ void recv_exclude_list(int f) char line[MAXPATHLEN]; int l; while ((l=read_int(f))) { - read_buf(f,line,l); - line[l] = 0; - add_exclude(line); + if (l >= MAXPATHLEN) overflow("recv_exclude_list"); + read_sbuf(f,line,l); + add_exclude(line); } }