Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Batch files need to be written with the new subprotocol value
[rsync/rsync.git]
/
backup.c
diff --git
a/backup.c
b/backup.c
index
8cac4d5
..
49985fa
100644
(file)
--- a/
backup.c
+++ b/
backup.c
@@
-23,6
+23,7
@@
extern int verbose;
extern int am_root;
extern int preserve_acls;
extern int verbose;
extern int am_root;
extern int preserve_acls;
+extern int preserve_xattrs;
extern int preserve_devices;
extern int preserve_specials;
extern int preserve_links;
extern int preserve_devices;
extern int preserve_specials;
extern int preserve_links;
@@
-133,6
+134,9
@@
static int make_bak_dir(char *fullpath)
} else {
#ifdef SUPPORT_ACLS
sx.acc_acl = sx.def_acl = NULL;
} else {
#ifdef SUPPORT_ACLS
sx.acc_acl = sx.def_acl = NULL;
+#endif
+#ifdef SUPPORT_XATTRS
+ sx.xattr = NULL;
#endif
if (!(file = make_file(rel, NULL, NULL, 0, NO_FILTERS)))
continue;
#endif
if (!(file = make_file(rel, NULL, NULL, 0, NO_FILTERS)))
continue;
@@
-143,7
+147,14
@@
static int make_bak_dir(char *fullpath)
free_acl(&sx);
}
#endif
free_acl(&sx);
}
#endif
- set_file_attrs(fullpath, file, NULL, 0);
+#ifdef SUPPORT_XATTRS
+ if (preserve_xattrs) {
+ get_xattr(rel, &sx);
+ cache_xattr(file, &sx);
+ free_xattr(&sx);
+ }
+#endif
+ set_file_attrs(fullpath, file, NULL, NULL, 0);
free(file);
}
}
free(file);
}
}
@@
-194,6
+205,9
@@
static int keep_backup(const char *fname)
#ifdef SUPPORT_ACLS
sx.acc_acl = sx.def_acl = NULL;
#endif
#ifdef SUPPORT_ACLS
sx.acc_acl = sx.def_acl = NULL;
#endif
+#ifdef SUPPORT_XATTRS
+ sx.xattr = NULL;
+#endif
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
@@
-210,6
+224,13
@@
static int keep_backup(const char *fname)
free_acl(&sx);
}
#endif
free_acl(&sx);
}
#endif
+#ifdef SUPPORT_XATTRS
+ if (preserve_xattrs) {
+ get_xattr(fname, &sx);
+ cache_xattr(file, &sx);
+ free_xattr(&sx);
+ }
+#endif
/* Check to see if this is a device file, or link */
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
/* Check to see if this is a device file, or link */
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
@@
-288,7
+309,7
@@
static int keep_backup(const char *fname)
robust_unlink(fname); /* Just in case... */
}
}
robust_unlink(fname); /* Just in case... */
}
}
- set_file_attrs(buf, file, NULL, 0);
+ set_file_attrs(buf, file, NULL,
fname,
0);
unmake_file(file);
if (verbose > 1) {
unmake_file(file);
if (verbose > 1) {