Skip to content

Commit

Permalink
Allow a missing parent dir when --delete-missing-args was specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneD committed Apr 27, 2020
1 parent ea3337a commit af6118d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions generator.c
Expand Up @@ -1277,10 +1277,16 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
&& (*dn != '.' || dn[1]) /* Avoid an issue with --relative and the "." dir. */
&& (!prior_dir_file || strcmp(dn, f_name(prior_dir_file, NULL)) != 0)
&& flist_find_name(cur_flist, dn, 1) < 0) {
rprintf(FERROR,
"ABORTING due to invalid path from sender: %s/%s\n",
dn, file->basename);
exit_cleanup(RERR_PROTOCOL);
/* The --delete-missing-args option can actually put invalid entries into
* the file list, so if that option was specified, we'll just complain about
* it and allow it. */
if (missing_args == 2 && file->mode == 0)
rprintf(FERROR, "WARNING: parent dir is absent in the file list: %s\n", dn);
else {
rprintf(FERROR, "ABORTING due to invalid path from sender: %s/%s\n",
dn, file->basename);
exit_cleanup(RERR_PROTOCOL);
}
}
if (relative_paths && !implied_dirs
&& do_stat(dn, &sx.st) < 0) {
Expand Down Expand Up @@ -1383,7 +1389,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
added_perms = 0;
if (is_dir < 0) {
if (!(preserve_times & PRESERVE_DIR_TIMES))
return;
goto cleanup;
/* In inc_recurse mode we want to make sure any missing
* directories get created while we're still processing
* the parent dir (which allows us to touch the parent
Expand Down Expand Up @@ -1525,7 +1531,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
"ignoring unsafe symlink \"%s\" -> \"%s\"\n",
fname, sl);
}
return;
goto cleanup;
}
if (statret == 0) {
char lnk[MAXPATHLEN];
Expand Down

0 comments on commit af6118d

Please sign in to comment.