Commit | Line | Data |
---|---|---|
5ae2d14e WD |
1 | This patch makes the xattr functions skip devices and special files, |
2 | because OS X returns the wrong errno when getting/setting xattrs on | |
3 | them (it returns EPERM instead of ENOTSUP). | |
4 | ||
5 | To use this patch, run these commands for a successful build: | |
6 | ||
7 | patch -p1 <patches/osx-xattr-nodev.diff | |
8 | ./configure (optional if already run) | |
9 | make | |
10 | ||
11 | diff --git a/flist.c b/flist.c | |
12 | --- a/flist.c | |
13 | +++ b/flist.c | |
abd3adb8 | 14 | @@ -1408,6 +1408,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, |
5ae2d14e WD |
15 | #endif |
16 | #ifdef SUPPORT_XATTRS | |
17 | if (preserve_xattrs) { | |
18 | + sx.st.st_mode = file->mode; | |
19 | sx.xattr = NULL; | |
e8972101 WD |
20 | if (get_xattr(fname, &sx) < 0) { |
21 | io_error |= IOERR_GENERAL; | |
5ae2d14e WD |
22 | diff --git a/xattrs.c b/xattrs.c |
23 | --- a/xattrs.c | |
24 | +++ b/xattrs.c | |
25 | @@ -281,6 +281,10 @@ int get_xattr(const char *fname, stat_x *sxp) | |
26 | { | |
27 | sxp->xattr = new(item_list); | |
28 | *sxp->xattr = empty_xattr; | |
29 | + | |
30 | + if (IS_SPECIAL(sxp->st.st_mode) || IS_DEVICE(sxp->st.st_mode)) | |
31 | + return 0; | |
32 | + | |
33 | if (rsync_xal_get(fname, sxp->xattr) < 0) { | |
34 | free_xattr(sxp); | |
35 | return -1; | |
e2e42a01 | 36 | @@ -864,6 +868,11 @@ int set_xattr(const char *fname, const struct file_struct *file, |
5ae2d14e WD |
37 | return -1; |
38 | } | |
39 | ||
40 | + if (IS_SPECIAL(sxp->st.st_mode) || IS_DEVICE(sxp->st.st_mode)) { | |
41 | + errno = ENOTSUP; | |
42 | + return -1; | |
43 | + } | |
44 | + | |
45 | ndx = F_XATTR(file); | |
46 | return rsync_xal_set(fname, lst + ndx, fnamecmp, sxp); | |
47 | } |