char *fnamecmp, *partialptr, *backupptr = NULL;
char fnamecmpbuf[MAXPATHLEN];
uchar fnamecmp_type;
+ int implied_dirs_are_missing = relative_paths && !implied_dirs && !inc_recurse;
int del_opts = delete_mode || force_delete ? DEL_RECURSE : 0;
if (list_only)
if (server_filter_list.head) {
if (excluded_below >= 0) {
if (F_DEPTH(file) > excluded_below
- && (implied_dirs || f_name_has_prefix(file, excluded_dir)))
+ && (!implied_dirs_are_missing || f_name_has_prefix(file, excluded_dir)))
goto skipping;
excluded_below = -1;
}
if (missing_below >= 0) {
if (F_DEPTH(file) <= missing_below
- || (!implied_dirs && !f_name_has_prefix(file, missing_dir))) {
+ || (implied_dirs_are_missing && !f_name_has_prefix(file, missing_dir))) {
if (dry_run)
dry_run--;
missing_below = -1;
} else {
const char *dn = file->dirname ? file->dirname : ".";
if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) {
- if (relative_paths && !implied_dirs
- && do_stat(dn, &sx.st) < 0
+ if (implied_dirs_are_missing && do_stat(dn, &sx.st) < 0
&& create_directory_path(fname) < 0) {
rsyserr(FERROR, errno,
"recv_generator: mkdir %s failed",
}
if (S_ISDIR(file->mode)) {
- if (inc_recurse && ndx != cur_flist->ndx_start - 1
- && file->flags & FLAG_XFER_DIR) {
+ if (!implied_dirs && !(file->flags & FLAG_XFER_DIR))
+ goto cleanup;
+ if (inc_recurse && ndx != cur_flist->ndx_start - 1) {
/* In inc_recurse mode we want ot make sure any missing
* directories get created while we're still processing
* the parent dir (which allows us to touch the parent
* transfer and/or re-set any tweaked modified-time values. */
for (i = start; i <= end; i++, counter++) {
file = flist->files[i];
- if (!S_ISDIR(file->mode))
+ if (!S_ISDIR(file->mode)
+ || (relative_paths && !implied_dirs && !(file->flags & FLAG_XFER_DIR)))
continue;
if (verbose > 3) {
fname = f_name(file, NULL);
/* Skip directory touch-up. */
} else if (first_flist->ndx_start != 0)
touch_up_dirs(dir_flist, first_flist->parent_ndx);
- else if (relative_paths && implied_dirs)
- touch_up_dirs(first_flist, -1);
flist_free(first_flist); /* updates first_flist */
}