}
--- old/lib/sysxattr.c
+++ new/lib/sysxattr.c
-@@ -0,0 +1,136 @@
+@@ -0,0 +1,135 @@
+/*
+ * Extended attribute support for rsync.
+ *
+ * terminator. We need to change this into a series of null-terminted
+ * strings. Since the size is the same, we can simply transform the
+ * output in place. */
-+ for (off = 0; off < len; ) {
++ for (off = 0; off < len; off += keylen + 1) {
+ keylen = ((unsigned char*)list)[off];
+ if (off + keylen >= len) {
+ /* Should be impossible, but kernel bugs happen! */
+ return -1;
+ }
+ memmove(list+off, list+off+1, keylen);
-+ off += keylen;
-+ list[off++] = '\0';
++ list[off+keylen] = '\0';
+ }
+
+ return len;
transfer. The resulting value is treated as though it was the permissions
--- old/xattr.c
+++ new/xattr.c
-@@ -0,0 +1,415 @@
+@@ -0,0 +1,417 @@
+/*
+ * Extended Attribute support for rsync.
+ * Written by Jay Fenlason, vaguely based on the ACLs patch.
+ rsync_xa *rxa;
+ size_t name_len = read_int(f);
+ size_t datum_len = read_int(f);
-+ size_t extra_len = am_root < 0 ? RPRE_LEN : 0;
-+#ifndef HAVE_LINUX_XATTRS
++#ifdef HAVE_LINUX_XATTRS
++ size_t extra_len = 0;
++#else
++ size_t extra_len = am_root ? RPRE_LEN : 0;
+ if (datum_len + extra_len < datum_len)
+ out_of_memory("receive_xattr"); /* overflow */
+#endif