aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-09-05 10:25:42 -0700
committerWayne Davison <wayned@samba.org>2009-09-05 10:25:42 -0700
commit2f1fb732d4be844fb68829bdc1c8c103f8b2df60 (patch)
treef690be32b2a04f7766e31d1c18e6b3ed07116273
parent59924aa8cfd7f05c3305cc54dec906da82504e85 (diff)
downloadandroid_external_rsync-2f1fb732d4be844fb68829bdc1c8c103f8b2df60.tar.gz
android_external_rsync-2f1fb732d4be844fb68829bdc1c8c103f8b2df60.tar.bz2
android_external_rsync-2f1fb732d4be844fb68829bdc1c8c103f8b2df60.zip
Improve error handling and get rid of a lingering fprintf().
-rw-r--r--token.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/token.c b/token.c
index b3621b93..838f8c97 100644
--- a/token.c
+++ b/token.c
@@ -45,12 +45,12 @@ static void add_suffix(struct suffix_tree **prior, char ltr, const char *str)
if (ltr == '[') {
const char *after = strchr(str, ']');
- /* Just skip bogus character classes. */
- if (!after++)
+ /* Treat "[foo" and "[]" as having a literal '['. */
+ if (after && after++ != str+1) {
+ while ((ltr = *str++) != ']')
+ add_suffix(prior, ltr, after);
return;
- while ((ltr = *str++) != ']')
- add_suffix(prior, ltr, after);
- return;
+ }
}
for (node = *prior; node; prior = &node->sibling, node = node->sibling) {
@@ -100,7 +100,6 @@ static void add_nocompress_suffixes(const char *str)
} while (*++f != '/' && *f);
*t++ = '\0';
- fprintf(stderr, "adding `%s'\n", buf);
add_suffix(&suftree, *buf, buf+1);
}