Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improved the authentication and in particular the error reporting
[rsync/rsync.git]
/
exclude.c
diff --git
a/exclude.c
b/exclude.c
index
b5b230b
..
b2831e4
100644
(file)
--- a/
exclude.c
+++ b/
exclude.c
@@
-25,7
+25,7
@@
extern int verbose;
extern int verbose;
-static char **exclude_list
= NULL
;
+static char **exclude_list;
static int is_regex(char *str)
{
static int is_regex(char *str)
{
@@
-35,7
+35,6
@@
static int is_regex(char *str)
static int check_one_exclude(char *name,char *pattern)
{
static int check_one_exclude(char *name,char *pattern)
{
- char *str;
char *p;
if (!strchr(pattern,'/') && (p=strrchr(name,'/')))
char *p;
if (!strchr(pattern,'/') && (p=strrchr(name,'/')))
@@
-43,6
+42,8
@@
static int check_one_exclude(char *name,char *pattern)
if (!name[0]) return 0;
if (!name[0]) return 0;
+ if (*pattern == '/' && *name != '/') pattern++;
+
if (is_regex(pattern)) {
if (fnmatch(pattern, name, 0) == 0)
return 1;
if (is_regex(pattern)) {
if (fnmatch(pattern, name, 0) == 0)
return 1;
@@
-87,7
+88,7
@@
void add_exclude_list(char *pattern,char ***list)
if (strcmp(pattern,"!") == 0) {
if (verbose > 2)
if (strcmp(pattern,"!") == 0) {
if (verbose > 2)
-
fprintf(stderr
,"clearing exclude list\n");
+
rprintf(FINFO
,"clearing exclude list\n");
while ((len)--)
free((*list)[len]);
free((*list));
while ((len)--)
free((*list)[len]);
free((*list));
@@
-105,7
+106,7
@@
void add_exclude_list(char *pattern,char ***list)
out_of_memory("add_exclude");
if (verbose > 2)
out_of_memory("add_exclude");
if (verbose > 2)
-
fprintf(stderr
,"add_exclude(%s)\n",pattern);
+
rprintf(FINFO
,"add_exclude(%s)\n",pattern);
(*list)[len+1] = NULL;
}
(*list)[len+1] = NULL;
}
@@
-122,8
+123,8
@@
char **make_exclude_list(char *fname,char **list1,int fatal)
char line[MAXPATHLEN];
if (!f) {
if (fatal) {
char line[MAXPATHLEN];
if (!f) {
if (fatal) {
-
fprintf(stderr
,"%s : %s\n",fname,strerror(errno));
- exit(1);
+
rprintf(FERROR
,"%s : %s\n",fname,strerror(errno));
+ exit
_cleanup
(1);
}
return list;
}
}
return list;
}
@@
-164,9
+165,9
@@
void recv_exclude_list(int f)
char line[MAXPATHLEN];
int l;
while ((l=read_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);
}
}
}
}
@@
-189,7
+190,7
@@
void add_cvs_excludes(void)
for (i=0; cvs_ignore_list[i]; i++)
add_exclude(cvs_ignore_list[i]);
for (i=0; cvs_ignore_list[i]; i++)
add_exclude(cvs_ignore_list[i]);
- if ((p=getenv("HOME"))) {
+ if ((p=getenv("HOME"))
&& strlen(p) < (MAXPATHLEN-12)
) {
sprintf(fname,"%s/.cvsignore",p);
add_exclude_file(fname,0);
}
sprintf(fname,"%s/.cvsignore",p);
add_exclude_file(fname,0);
}