Fixed to work with the latest xattr.diff.
[rsync/rsync-patches.git] / fake-super.diff
index e4f47c5..e8a078a 100644 (file)
@@ -1,22 +1,21 @@
-Depends-On-Patch: acls.diff
-Depends-On-Patch: xattrs.diff
-
 This patch adds a new option:  --fake-super, which tells rsync to copy in a
 fake super-user mode that stores various file attributes in an extended-
 attribute value instead of as real file-system attributes.  See the changes
 to the manpages for details.
 
-After applying this patch, run these commands for a successful build:
+To use this patch, run these commands for a successful build:
 
+    patch -p1 <patches/acls.diff
+    patch -p1 <patches/xattrs.diff
+    patch -p1 <patches/fake-super.diff
     ./prepare-source
     ./configure --enable-xattr-support
     make
 
-or, if you want ACL support too:
+If you want ACL support too, use this configure command instead of the one
+above:
 
-    ./prepare-source
     ./configure --enable-acl-support --enable-xattr-support
-    make
 
 --- old/backup.c
 +++ new/backup.c
@@ -450,7 +449,7 @@ or, if you want ACL support too:
  typedef struct {
        char *name;
        char *datum;
-@@ -132,9 +135,15 @@ static int rsync_xal_get(const char *fna
+@@ -134,9 +137,15 @@ static int rsync_xal_get(const char *fna
        if (name_size == 0)
                return 0;
        for (left = name_size, name = namebuf; left > 0 ; left -= len, name += len) {
@@ -467,7 +466,7 @@ or, if you want ACL support too:
                datum_size = sys_lgetxattr(fname, name, NULL, 0);
                if (datum_size < 0) {
                        if (errno == ENOTSUP)
-@@ -287,10 +296,19 @@ void receive_xattr(struct file_struct *f
+@@ -288,6 +297,14 @@ void receive_xattr(struct file_struct *f
                                out_of_memory("receive_xattr");
                        read_buf(f, ptr, name_len);
                        read_buf(f, ptr + name_len, datum_len);
@@ -482,12 +481,7 @@ or, if you want ACL support too:
                        rxa->name_len = name_len;
                        rxa->datum_len = datum_len;
                        rxa->name = ptr;
-                       rxa->datum = ptr + name_len;
-+
- #ifdef HAVE_OSX_XATTRS
-                       if (strncmp(rxa->name, UNIQUE_PREFIX, UPRE_LEN) == 0) {
-                               rxa->name_len -= UPRE_LEN;
-@@ -372,4 +390,146 @@ int set_xattr(const char *fname, const s
+@@ -373,4 +390,146 @@ int set_xattr(const char *fname, const s
        return rsync_xal_set(fname, lst + ndx); /* TODO:  This needs to return 1 if no xattrs changed! */
  }
  
@@ -596,7 +590,7 @@ or, if you want ACL support too:
 +                      to_wire_mode(file->mode) & (_S_IFMT|CHMOD_BITS),
 +                      (int)major(rdev), (int)minor(rdev),
 +                      (int)file->uid, (int)file->gid);
-+              if (sys_lsetxattr(fname, FAKE_XATTR, buf, len, 0) < 0) {
++              if (sys_lsetxattr(fname, FAKE_XATTR, buf, len) < 0) {
 +                      if (errno == EPERM && S_ISLNK(fst.st_mode))
 +                              return 0;
 +                      rsyserr(FERROR, errno,