1110d0
commit af6118d98b3482cbcfc223bf2a0777bc19eccb02
1110d0
Author: Wayne Davison <wayne@opencoder.net>
1110d0
Date:   Sun Apr 26 18:02:17 2020 -0700
1110d0
1110d0
    Allow a missing parent dir when --delete-missing-args was specified.
1110d0
1110d0
diff --git a/generator.c b/generator.c
1110d0
index 3c50f63f..b90c7ccd 100644
1110d0
--- a/generator.c
1110d0
+++ b/generator.c
1110d0
@@ -1277,10 +1277,16 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
1110d0
 			 && (*dn != '.' || dn[1]) /* Avoid an issue with --relative and the "." dir. */
1110d0
 			 && (!prior_dir_file || strcmp(dn, f_name(prior_dir_file, NULL)) != 0)
1110d0
 			 && flist_find_name(cur_flist, dn, 1) < 0) {
1110d0
-				rprintf(FERROR,
1110d0
-					"ABORTING due to invalid path from sender: %s/%s\n",
1110d0
-					dn, file->basename);
1110d0
-				exit_cleanup(RERR_PROTOCOL);
1110d0
+				/* The --delete-missing-args option can actually put invalid entries into
1110d0
+				 * the file list, so if that option was specified, we'll just complain about
1110d0
+				 * it and allow it. */
1110d0
+				if (missing_args == 2 && file->mode == 0)
1110d0
+					rprintf(FERROR, "WARNING: parent dir is absent in the file list: %s\n", dn);
1110d0
+				else {
1110d0
+					rprintf(FERROR, "ABORTING due to invalid path from sender: %s/%s\n",
1110d0
+						dn, file->basename);
1110d0
+					exit_cleanup(RERR_PROTOCOL);
1110d0
+				}
1110d0
 			}
1110d0
 			if (relative_paths && !implied_dirs
1110d0
 			 && do_stat(dn, &sx.st) < 0) {
1110d0
@@ -1383,7 +1389,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
1110d0
 			added_perms = 0;
1110d0
 		if (is_dir < 0) {
1110d0
 			if (!(preserve_times & PRESERVE_DIR_TIMES))
1110d0
-				return;
1110d0
+				goto cleanup;
1110d0
 			/* In inc_recurse mode we want to make sure any missing
1110d0
 			 * directories get created while we're still processing
1110d0
 			 * the parent dir (which allows us to touch the parent
1110d0
@@ -1525,7 +1531,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
1110d0
 					"ignoring unsafe symlink \"%s\" -> \"%s\"\n",
1110d0
 					fname, sl);
1110d0
 			}
1110d0
-			return;
1110d0
+			goto cleanup;
1110d0
 		}
1110d0
 		if (statret == 0) {
1110d0
 			char lnk[MAXPATHLEN];