+ 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 SUPPORT_LINKS
+ if (statret == 0 && keep_dirlinks
+ && S_ISLNK(st.st_mode) && S_ISDIR(file->mode)) {
+ STRUCT_STAT st2;
+ if (do_stat(fname, &st2) == 0 && S_ISDIR(st2.st_mode))
+ st = st2;
+ }
+#endif
+
+ 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);
+ }
+