Got rid of kluged value for am_sender, and instead added a new
[rsync/rsync.git] / exclude.c
index 9a7a81c..fa11e44 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -133,6 +133,19 @@ static void add_rule(struct filter_list_struct *listp, const char *pat,
                        listp->debug_type);
        }
 
+       /* This flag also indicates that we're reading a list that
+        * needs to be filtered now, not post-filtered later. */
+       if (xflags & XFLG_ANCHORED2ABS) {
+               uint32 mf = mflags & (MATCHFLG_RECEIVER_SIDE|MATCHFLG_SENDER_SIDE);
+               if (am_sender) {
+                       if (mf == MATCHFLG_RECEIVER_SIDE)
+                               return;
+               } else {
+                       if (mf == MATCHFLG_SENDER_SIDE)
+                               return;
+               }
+       }
+
        if (!(ret = new(struct filter_struct)))
                out_of_memory("add_rule");
        memset(ret, 0, sizeof ret[0]);
@@ -608,9 +621,9 @@ int check_filter(struct filter_list_struct *listp, char *name, int name_is_dir)
 
 #define RULE_STRCMP(s,r) rule_strcmp((s), (r), sizeof (r) - 1)
 
-static const char *rule_strcmp(const char *str, const char *rule, int rule_len)
+static const uchar *rule_strcmp(const uchar *str, const char *rule, int rule_len)
 {
-       if (strncmp(str, rule, rule_len) != 0)
+       if (strncmp((char*)str, rule, rule_len) != 0)
                return NULL;
        if (isspace(str[rule_len]) || str[rule_len] == '_' || !str[rule_len])
                return str + rule_len - 1;