From a3dbb20a0e136662b1b93349357d0b18972d928a Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 10 Apr 2004 10:31:11 +0000 Subject: [PATCH] Fixed a bug where an exclude name that got sent over the wire could get an extra "- " or "+ " parsed off the start of the name (i.e. we have to quote excluded names that start with those strings with an extra "- " at the start). --- exclude.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/exclude.c b/exclude.c index e0c8bed7..1003f6a7 100644 --- a/exclude.c +++ b/exclude.c @@ -328,32 +328,34 @@ void send_exclude_list(int f) add_exclude(&exclude_list, "/*/*", ADD_EXCLUDE); if (!exclude_list) { - write_int(f,0); + write_int(f, 0); return; } for (i = 0; exclude_list[i]; i++) { unsigned int l; - char pattern[MAXPATHLEN+1]; + char p[MAXPATHLEN+1]; - l = strlcpy(pattern, exclude_list[i]->pattern, sizeof pattern); + l = strlcpy(p, exclude_list[i]->pattern, sizeof p); if (l == 0 || l >= MAXPATHLEN) continue; if (exclude_list[i]->directory) { - pattern[l++] = '/'; - pattern[l] = '\0'; + p[l++] = '/'; + p[l] = '\0'; } if (exclude_list[i]->include) { - write_int(f,l+2); - write_buf(f,"+ ",2); - } else { - write_int(f,l); - } - write_buf(f,pattern,l); + write_int(f, l + 2); + write_buf(f, "+ ", 2); + } else if ((*p == '-' || *p == '+') && p[1] == ' ') { + write_int(f, l + 2); + write_buf(f, "- ", 2); + } else + write_int(f, l); + write_buf(f, p, l); } - write_int(f,0); + write_int(f, 0); } @@ -446,7 +448,7 @@ void add_cvs_excludes(void) char *p; int i; - for (i=0; cvs_ignore_list[i]; i++) + for (i = 0; cvs_ignore_list[i]; i++) add_exclude(&exclude_list, cvs_ignore_list[i], ADD_EXCLUDE); if ((p = getenv("HOME")) -- 2.34.1