Fix --remove-source-files sanity check w/--copy-links the right way.
[rsync.git] / receiver.c
index 9fdafa152cb38d0fa8191b14af5cfc49a06a185c..d6a48f14a66772eda9a3c15c349ccec7f641d6d2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 1996-2000 Andrew Tridgell
  * Copyright (C) 1996 Paul Mackerras
- * Copyright (C) 2003-2015 Wayne Davison
+ * Copyright (C) 2003-2018 Wayne Davison
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -574,15 +574,15 @@ int recv_files(int f_in, int f_out, char *local_name)
                        file = dir_flist->files[cur_flist->parent_ndx];
                fname = local_name ? local_name : f_name(file, fbuf);
 
-               if (daemon_filter_list.head
-                   && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
+               if (DEBUG_GTE(RECV, 1))
+                       rprintf(FINFO, "recv_files(%s)\n", fname);
+
+               if (daemon_filter_list.head && (*fname != '.' || fname[1] != '\0')
+                && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
                        rprintf(FERROR, "attempt to hack rsync failed.\n");
                        exit_cleanup(RERR_PROTOCOL);
                }
 
-               if (DEBUG_GTE(RECV, 1))
-                       rprintf(FINFO, "recv_files(%s)\n", fname);
-
 #ifdef SUPPORT_XATTRS
                if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers
                 && !(want_xattr_optim && BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE)))
@@ -722,7 +722,7 @@ int recv_files(int f_in, int f_out, char *local_name)
                                break;
                        }
                        if (!fnamecmp || (daemon_filter_list.head
-                         && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0)) {
+                         && check_filter(&daemon_filter_list, FLOG, fnamecmp, 0) < 0)) {
                                fnamecmp = fname;
                                fnamecmp_type = FNAMECMP_FNAME;
                        }