-@@ -498,7 +499,7 @@ static struct file_struct *receive_file_
- char thisname[MAXPATHLEN];
- unsigned int l1 = 0, l2 = 0;
- int alloc_len, basename_len, dirname_len, linkname_len, sum_len;
--#ifdef SUPPORT_ACLS
-+#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
- int xtra_len;
- #endif
- OFF_T file_length;
-@@ -610,10 +611,16 @@ static struct file_struct *receive_file_
- xtra_len = (S_ISDIR(mode) ? 2 : 1) * 4;
- else
- xtra_len = 0;
-+#elif defined SUPPORT_XATTRS
-+ xtra_len = 0;
-+#endif
-+#ifdef SUPPORT_XATTRS
-+ if (preserve_xattrs)
-+ xtra_len += 4;
- #endif
-
- alloc_len = file_struct_len + dirname_len + basename_len
--#ifdef SUPPORT_ACLS
-+#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
- + xtra_len
- #endif
- + linkname_len + sum_len;
-@@ -622,7 +629,7 @@ static struct file_struct *receive_file_
- file = (struct file_struct *)bp;
- memset(bp, 0, file_struct_len);
- bp += file_struct_len;
--#ifdef SUPPORT_ACLS
-+#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
- bp += xtra_len;
- #endif
-
-@@ -723,6 +730,10 @@ static struct file_struct *receive_file_
- if (preserve_acls)
+@@ -864,6 +865,10 @@ static struct file_struct *recv_file_ent
+ if (preserve_acls && !S_ISLNK(mode))