+ if (server_exclude_list.head
+ && check_exclude(&server_exclude_list, fname,
+ S_ISDIR(file->mode)) < 0) {
+ if (verbose) {
+ rprintf(FINFO, "skipping server-excluded file \"%s\"\n",
+ fname);
+ }
+ return;
+ }
+
+ statret = link_stat(fname, &st, keep_dirlinks && S_ISDIR(file->mode));
+
+ if (only_existing && statret == -1 && errno == ENOENT) {
+ /* we only want to update existing files */
+ if (verbose > 1)
+ rprintf(FINFO, "not creating new file \"%s\"\n", fname);
+ return;
+ }
+
+ if (statret == 0 &&
+ !preserve_perms &&
+ (S_ISDIR(st.st_mode) == S_ISDIR(file->mode))) {
+ /* if the file exists already and we aren't perserving
+ * permissions then act as though the remote end sent
+ * us the file permissions we already have */
+ file->mode = (file->mode & ~CHMOD_BITS)
+ | (st.st_mode & CHMOD_BITS);
+ }