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;
if (p >= rel) {
/* Try to transfer the directory settings of the
* actual dir that the files are coming from. */
- if (do_stat(rel, &sx.st) < 0) {
+ if (x_stat(rel, &sx.st, NULL) < 0) {
rsyserr(FERROR, errno,
"make_bak_dir stat %s failed",
full_fname(rel));
} 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;
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);
}
}
int ret_code;
/* return if no file to keep */
- if (do_lstat(fname, &sx.st) < 0)
+ if (x_lstat(fname, &sx.st, NULL) < 0)
return 1;
#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 */
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))
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) {