Added a command-line override for daemon config parameters:
[rsync/rsync.git] / exclude.c
index 9db8f1a..9672bf9 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -22,7 +22,6 @@
 
 #include "rsync.h"
 
-extern int verbose;
 extern int am_server;
 extern int am_sender;
 extern int eol_nulls;
@@ -37,7 +36,7 @@ extern int sanitize_paths;
 extern int protocol_version;
 extern int module_id;
 
-extern char curr_dir[];
+extern char curr_dir[MAXPATHLEN];
 extern unsigned int curr_dir_len;
 extern unsigned int module_dirlen;
 
@@ -123,7 +122,7 @@ static void add_rule(struct filter_list_struct *listp, const char *pat,
        const char *cp;
        unsigned int pre_len, suf_len, slash_cnt = 0;
 
-       if (verbose > 2) {
+       if (DEBUG_GTE(FILTER, 2)) {
                rprintf(FINFO, "[%s] add_rule(%s%.*s%s)%s\n",
                        who_am_i(), get_rule_prefix(mflags, pat, 0, NULL),
                        (int)pat_len, pat,
@@ -332,12 +331,13 @@ static char *parse_merge_name(const char *merge_file, unsigned int *len_ptr,
 
        /* If the name isn't in buf yet, it's wasn't absolute. */
        if (fn != buf) {
-               if (dirbuf_len + fn_len >= MAXPATHLEN) {
+               int d_len = dirbuf_len - prefix_skip;
+               if (d_len + fn_len >= MAXPATHLEN) {
                        rprintf(FERROR, "merge-file name overflows: %s\n", fn);
                        return NULL;
                }
-               memcpy(buf, dirbuf + prefix_skip, dirbuf_len - prefix_skip);
-               memcpy(buf + dirbuf_len - prefix_skip, fn, fn_len + 1);
+               memcpy(buf, dirbuf + prefix_skip, d_len);
+               memcpy(buf + d_len, fn, fn_len + 1);
                fn_len = clean_fname(buf, CFN_COLLAPSE_DOT_DOT_DIRS);
        }
 
@@ -454,7 +454,7 @@ void *push_local_filters(const char *dir, unsigned int dirlen)
                struct filter_struct *ex = mergelist_parents[i];
                struct filter_list_struct *lp = ex->u.mergelist;
 
-               if (verbose > 2) {
+               if (DEBUG_GTE(FILTER, 2)) {
                        rprintf(FINFO, "[%s] pushing filter list%s\n",
                                who_am_i(), lp->debug_type);
                }
@@ -494,7 +494,7 @@ void pop_local_filters(void *mem)
                struct filter_struct *ex = mergelist_parents[i];
                struct filter_list_struct *lp = ex->u.mergelist;
 
-               if (verbose > 2) {
+               if (DEBUG_GTE(FILTER, 2)) {
                        rprintf(FINFO, "[%s] popping filter list%s\n",
                                who_am_i(), lp->debug_type);
                }
@@ -628,7 +628,7 @@ static void report_filter_result(enum logcode code, char const *name,
         * then it is stripped out by add_rule().  So as a special
         * case we add it back in here. */
 
-       if (verbose >= 2) {
+       if (DEBUG_GTE(FILTER, 1)) {
                static char *actions[2][2]
                    = { {"show", "hid"}, {"risk", "protect"} };
                const char *w = who_am_i();
@@ -972,7 +972,7 @@ void parse_rule(struct filter_list_struct *listp, const char *pattern,
                }
 
                if (new_mflags & MATCHFLG_CLEAR_LIST) {
-                       if (verbose > 2) {
+                       if (DEBUG_GTE(FILTER, 2)) {
                                rprintf(FINFO,
                                        "[%s] clearing filter list%s\n",
                                        who_am_i(), listp->debug_type);
@@ -1046,7 +1046,7 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname,
        } else
                fp = stdin;
 
-       if (verbose > 2) {
+       if (DEBUG_GTE(FILTER, 2)) {
                rprintf(FINFO, "[%s] parse_filter_file(%s,%x,%x)%s\n",
                        who_am_i(), fname, mflags, xflags,
                        fp ? "" : " [not found]");