- The pool_alloc library has received some minor improvements in alignment
handling.
+
+ - Added init_stat_x() function to avoid duplication of acl/xattr init code.
*/
#include "rsync.h"
+#include "ifuncs.h"
extern int am_root;
extern int preserve_acls;
if (p >= rel) {
/* Try to transfer the directory settings of the
* actual dir that the files are coming from. */
+ init_stat_x(&sx);
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;
#ifdef SUPPORT_ACLS
int kept = 0;
int ret_code;
- /* return if no file to keep */
+ init_stat_x(&sx);
+ /* Return success if no file to keep. */
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 */
#endif
#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
stat_x sx;
+ init_stat_x(&sx);
#endif
#ifdef SUPPORT_LINKS
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
sx.st.st_mode = file->mode;
- sx.acc_acl = sx.def_acl = NULL;
if (get_acl(fname, &sx) < 0) {
io_error |= IOERR_GENERAL;
return NULL;
#endif
#ifdef SUPPORT_XATTRS
if (preserve_xattrs) {
- sx.xattr = NULL;
if (get_xattr(fname, &sx) < 0) {
io_error |= IOERR_GENERAL;
return NULL;
#include "rsync.h"
#include "inums.h"
+#include "ifuncs.h"
extern int dry_run;
extern int do_xfers;
}
}
-#ifdef SUPPORT_ACLS
- sx.acc_acl = sx.def_acl = NULL;
-#endif
-#ifdef SUPPORT_XATTRS
- sx.xattr = NULL;
-#endif
+ init_stat_x(&sx);
if (dry_run > 1 || (dry_missing_dir && is_below(file, dry_missing_dir))) {
parent_is_dry_missing:
if (fuzzy_dirlist) {
#include "rsync.h"
#include "inums.h"
+#include "ifuncs.h"
extern int dry_run;
extern int list_only;
char cmpbuf[MAXPATHLEN];
stat_x alt_sx;
int j = 0;
-#ifdef SUPPORT_ACLS
- alt_sx.acc_acl = alt_sx.def_acl = NULL;
-#endif
-#ifdef SUPPORT_XATTRS
- alt_sx.xattr = NULL;
-#endif
+ init_stat_x(&alt_sx);
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
if (link_stat(cmpbuf, &alt_sx.st, 0) < 0)
} else
our_name = fname;
-#ifdef SUPPORT_ACLS
- prev_sx.acc_acl = prev_sx.def_acl = NULL;
-#endif
-#ifdef SUPPORT_XATTRS
- prev_sx.xattr = NULL;
-#endif
+ init_stat_x(&prev_sx);
while ((ndx = prev_ndx) >= 0) {
int val;
return di->d_name;
#endif
}
+
+static inline void
+init_stat_x(stat_x *sx_p)
+{
+#ifdef SUPPORT_ACLS
+ sx_p->acc_acl = sx_p->def_acl = NULL;
+#endif
+#ifdef SUPPORT_XATTRS
+ sx_p->xattr = NULL;
+#endif
+}
full_fname(fname));
return 0;
}
-#ifdef SUPPORT_ACLS
- sx2.acc_acl = sx2.def_acl = NULL;
-#endif
-#ifdef SUPPORT_XATTRS
- sx2.xattr = NULL;
-#endif
+ init_stat_x(&sx2);
sxp = &sx2;
inherit = !preserve_perms;
} else