Commit cae7885e authored by Wayne Davison's avatar Wayne Davison

Don't output a duplicate warning when the daemon-config excludes a

directory or when a directory is ignored via --ignore-non-existing.
Use a new var, is_dir, to simplify the dir code in recv_generator().
parent eaa28e65
...@@ -1202,29 +1202,33 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ...@@ -1202,29 +1202,33 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
uchar fnamecmp_type; uchar fnamecmp_type;
int implied_dirs_are_missing = relative_paths && !implied_dirs && protocol_version < 30; int implied_dirs_are_missing = relative_paths && !implied_dirs && protocol_version < 30;
int del_opts = delete_mode || force_delete ? DEL_RECURSE : 0; int del_opts = delete_mode || force_delete ? DEL_RECURSE : 0;
int is_dir = !S_ISDIR(file->mode) ? 0
: inc_recurse && ndx != cur_flist->ndx_start - 1 ? -1
: 1;
if (verbose > 2) if (verbose > 2)
rprintf(FINFO, "recv_generator(%s,%d)\n", fname, ndx); rprintf(FINFO, "recv_generator(%s,%d)\n", fname, ndx);
if (list_only) { if (list_only) {
if (S_ISDIR(file->mode) if (is_dir < 0
&& ((!implied_dirs && file->flags & FLAG_IMPLIED_DIR) || (is_dir && !implied_dirs && file->flags & FLAG_IMPLIED_DIR))
|| (inc_recurse && ndx != cur_flist->ndx_start - 1)))
return; return;
list_file_entry(file); list_file_entry(file);
return; return;
} }
if (server_filter_list.head) { if (server_filter_list.head) {
int filtered = check_filter(&server_filter_list, fname, is_dir) < 0;
if (is_dir < 0 && filtered)
return;
if (excluded_below >= 0) { if (excluded_below >= 0) {
if (F_DEPTH(file) > excluded_below if (F_DEPTH(file) > excluded_below
&& (!implied_dirs_are_missing || f_name_has_prefix(file, excluded_dir))) && (!implied_dirs_are_missing || f_name_has_prefix(file, excluded_dir)))
goto skipping; goto skipping;
excluded_below = -1; excluded_below = -1;
} }
if (check_filter(&server_filter_list, fname, if (filtered) {
S_ISDIR(file->mode)) < 0) { if (is_dir) {
if (S_ISDIR(file->mode)) {
excluded_below = F_DEPTH(file); excluded_below = F_DEPTH(file);
excluded_dir = file; excluded_dir = file;
} }
...@@ -1243,7 +1247,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ...@@ -1243,7 +1247,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
dry_run--; dry_run--;
missing_below = -1; missing_below = -1;
} else if (!dry_run) { } else if (!dry_run) {
if (S_ISDIR(file->mode)) if (is_dir)
file->flags |= FLAG_MISSING_DIR; file->flags |= FLAG_MISSING_DIR;
return; return;
} }
...@@ -1291,18 +1295,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ...@@ -1291,18 +1295,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
need_fuzzy_dirlist = 0; need_fuzzy_dirlist = 0;
} }
statret = link_stat(fname, &sx.st, statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno; stat_errno = errno;
} }
if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) { if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) {
if (verbose > 1) { if (is_dir) {
rprintf(FINFO, "not creating new %s \"%s\"\n", if (is_dir < 0)
S_ISDIR(file->mode) ? "directory" : "file", return;
fname);
}
if (S_ISDIR(file->mode)) {
if (missing_below < 0) { if (missing_below < 0) {
if (dry_run) if (dry_run)
dry_run++; dry_run++;
...@@ -1311,16 +1311,20 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ...@@ -1311,16 +1311,20 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
} }
file->flags |= FLAG_MISSING_DIR; file->flags |= FLAG_MISSING_DIR;
} }
if (verbose > 1) {
rprintf(FINFO, "not creating new %s \"%s\"\n",
is_dir ? "directory" : "file", fname);
}
return; return;
} }
if (statret == 0 && sx.st.st_uid == our_uid) if (statret == 0 && sx.st.st_uid == our_uid)
del_opts |= DEL_OWNED_BY_US; del_opts |= DEL_OWNED_BY_US;
if (S_ISDIR(file->mode)) { if (is_dir) {
if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR) if (!implied_dirs && file->flags & FLAG_IMPLIED_DIR)
goto cleanup; goto cleanup;
if (inc_recurse && ndx != cur_flist->ndx_start - 1) { if (is_dir < 0) {
/* In inc_recurse mode we want to make sure any missing /* In inc_recurse mode we want to make sure any missing
* directories get created while we're still processing * directories get created while we're still processing
* the parent dir (which allows us to touch the parent * the parent dir (which allows us to touch the parent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment