Make OS X avoid xattr access on device/special files.
Fixes bug 5458.
extern int orig_umask;
extern int numeric_ids;
extern int inc_recurse;
extern int orig_umask;
extern int numeric_ids;
extern int inc_recurse;
+extern int preserve_devices;
+extern int preserve_specials;
/* Flags used to indicate what items are being transmitted for an entry. */
#define XMIT_USER_OBJ (1<<0)
/* Flags used to indicate what items are being transmitted for an entry. */
#define XMIT_USER_OBJ (1<<0)
int get_acl(const char *fname, stat_x *sxp)
{
sxp->acc_acl = create_racl();
int get_acl(const char *fname, stat_x *sxp)
{
sxp->acc_acl = create_racl();
+
+ if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
+ /* Everyone supports this. */
+ } else if (S_ISLNK(sxp->st.st_mode)) {
+ return 0;
+ } else if (IS_SPECIAL(sxp->st.st_mode)) {
+#ifndef NO_SPECIAL_ACLS
+ if (!preserve_specials)
+#endif
+ return 0;
+ } else if (IS_DEVICE(sxp->st.st_mode)) {
+#ifndef NO_DEVICE_ACLS
+ if (!preserve_devices)
+#endif
+ return 0;
+ }
+
if (get_rsync_acl(fname, sxp->acc_acl, SMB_ACL_TYPE_ACCESS,
sxp->st.st_mode) < 0) {
free_acl(sxp);
if (get_rsync_acl(fname, sxp->acc_acl, SMB_ACL_TYPE_ACCESS,
sxp->st.st_mode) < 0) {
free_acl(sxp);
AC_MSG_RESULT(Using OS X xattrs)
AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
AC_DEFINE(SUPPORT_XATTRS, 1)
AC_MSG_RESULT(Using OS X xattrs)
AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
AC_DEFINE(SUPPORT_XATTRS, 1)
+ AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
+ AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs])
;;
freebsd*)
AC_MSG_RESULT(Using FreeBSD extattrs)
;;
freebsd*)
AC_MSG_RESULT(Using FreeBSD extattrs)
extern int read_only;
extern int list_only;
extern int preserve_xattrs;
extern int read_only;
extern int list_only;
extern int preserve_xattrs;
+extern int preserve_links;
+extern int preserve_devices;
+extern int preserve_specials;
extern int checksum_seed;
#define RSYNC_XAL_INITIAL 5
extern int checksum_seed;
#define RSYNC_XAL_INITIAL 5
sxp->xattr = new(item_list);
*sxp->xattr = empty_xattr;
sxp->xattr = new(item_list);
*sxp->xattr = empty_xattr;
-#ifdef NO_SPECIAL_XATTRS
- if (IS_SPECIAL(sxp->st.st_mode))
- return 0;
+ if (S_ISREG(sxp->st.st_mode) || S_ISDIR(sxp->st.st_mode)) {
+ /* Everyone supports this. */
+ } else if (S_ISLNK(sxp->st.st_mode)) {
+#ifndef NO_SYMLINK_XATTRS
+ if (!preserve_links)
-#ifdef NO_DEVICE_XATTRS
- if (IS_DEVICE(sxp->st.st_mode))
- return 0;
+ return 0;
+ } else if (IS_SPECIAL(sxp->st.st_mode)) {
+#ifndef NO_SPECIAL_XATTRS
+ if (!preserve_specials)
-#ifdef NO_SYMLINK_XATTRS
- if (S_ISLNK(sxp->st.st_mode))
- return 0;
+ return 0;
+ } else if (IS_DEVICE(sxp->st.st_mode)) {
+#ifndef NO_DEVICE_XATTRS
+ if (!preserve_devices)
if (rsync_xal_get(fname, sxp->xattr) < 0) {
free_xattr(sxp);
if (rsync_xal_get(fname, sxp->xattr) < 0) {
free_xattr(sxp);