diff -udbrN flist.c flist.c
--- flist.c	2005-11-28 00:28:22.000000000 +0100
+++ flist.c	2005-11-28 00:32:35.000000000 +0100
@@ -1017,6 +1017,7 @@
 			file2->length = 1;
 			file2->mode = S_IFREG | S_IRUSR;
 
+			flist_expand(flist);
 			flist->files[flist->count++] = file2;
 
 			if (f != -1)
diff -udbrN receiver.c receiver.c
--- receiver.c	2005-11-28 00:28:22.000000000 +0100
+++ receiver.c	2005-11-28 00:06:04.000000000 +0100
@@ -66,6 +66,18 @@
 {
 	if (!is_dir) {
 		if (robust_unlink(fn) != 0) {
+#ifdef EA_SUPPORT
+			/* Prevent flooding the syslog when trying to delete the
+			   synthetic (= fake) file containing extended attributes. */
+#ifdef HAVE_COPYFILE
+			if (errno == ENOENT && extended_attributes 
+				&& !strncmp(basename(fn), "._", 2)) {
+				if (verbose)
+				rprintf(FINFO, "synthetic file %s could not be deleted\n",
+					safe_fname(fn));
+			} else
+#endif
+#endif
 			rsyserr(FERROR, errno, "delete_one: unlink %s failed",
 				full_fname(fn));
 		} else if (verbose)
diff -udbrN rsync.c rsync.c
--- rsync.c	2004-09-07 22:37:36.000000000 +0200
+++ rsync.c	2005-11-27 19:33:31.000000000 +0100
@@ -22,6 +22,10 @@
 
 #include "rsync.h"
 
+#ifdef HAVE_COPYFILE
+#include <libgen.h>
+#endif
+
 extern int verbose;
 extern int dry_run;
 extern int preserve_times;
@@ -37,6 +41,10 @@
 extern char *backup_dir;
 extern int inplace;
 
+#ifdef EA_SUPPORT
+extern int extended_attributes;
+#endif
+
 
 /*
   free a sums struct
@@ -238,6 +246,9 @@
 		     int ok_to_set_time)
 {
 	int ret;
+#ifdef HAVE_COPYFILE
+	char fnamereal[MAXPATHLEN];
+#endif
 
 	if (inplace) {
 		if (verbose > 2)
@@ -264,10 +275,33 @@
 	}
 	if (ret == 0) {
 		/* The file was moved into place (not copied), so it's done. */
-		return;
+		goto do_fix_extfile_mtime;
 	}
     do_set_perms:
 	set_perms(fname, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
+
+	do_fix_extfile_mtime:
+#ifdef EA_SUPPORT
+	/* JDB: When rsync'ing data with extended attributes TO a machine 
+	   supporting copyfile, moving the synthetic file into place will
+	   change the mtime of the 'real' file. Since the code in generator.c
+	   guarantees that the synthetic file will be transferred after the
+	   real file, it is sufficient (although kludgy) to re-adjust
+	   the mtime of the real file here. */
+#ifdef HAVE_COPYFILE
+	if (extended_attributes) {
+		if (!strncmp(basename(fname), "._", 2) && ok_to_set_time) {
+			snprintf(fnamereal, MAXPATHLEN, "%s/%s",
+					dirname(fname), basename(fname) + 2);
+			if (set_modtime(fnamereal, file->modtime) != 0) {
+				rsyserr(FERROR, errno, "failed to set times for real file of %s",
+					full_fname(fname));
+			}
+		}
+	}
+#endif
+#endif
+	return;
 }
 
 const char *who_am_i(void)

