Avoid some extraneous parent-dir warnings
authorWayne Davison <wayne@opencoder.net>
Tue, 21 Jul 2020 18:42:32 +0000 (11:42 -0700)
committerWayne Davison <wayne@opencoder.net>
Tue, 21 Jul 2020 18:54:54 +0000 (11:54 -0700)
Don't complain about an absent parent dir if the current file is marked
as missing and there is a marked-as-missing entry for the parent dir.

generator.c

index 96a36bea5f41b594299aa9accff7634a4b68ee38..1648db1c1df1c3f897a0d8a64cba8a330ca99716 100644 (file)
@@ -1277,14 +1277,19 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                         * this function was asked to process in the file list. */
                        if (!inc_recurse
                         && (*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) {
+                        && (!prior_dir_file || strcmp(dn, f_name(prior_dir_file, NULL)) != 0)) {
+                               int ok = 0, j = flist_find_name(cur_flist, dn, -1);
+                               if (j >= 0) {
+                                       struct file_struct *f = cur_flist->sorted[j];
+                                       if (S_ISDIR(f->mode) || (missing_args == 2 && !file->mode && !f->mode))
+                                               ok = 1;
+                               }
                                /* 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)
+                               if (!ok && missing_args == 2 && file->mode == 0 && j < 0)
                                        rprintf(FERROR, "WARNING: parent dir is absent in the file list: %s\n", dn);
-                               else {
+                               else if (!ok) {
                                        rprintf(FERROR, "ABORTING due to invalid path from sender: %s/%s\n",
                                                dn, file->basename);
                                        exit_cleanup(RERR_PROTOCOL);