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 | |
fc557362 | 12 | index 09b4fc5..a948194 100644 |
5ae2d14e WD |
13 | --- a/flist.c |
14 | +++ b/flist.c | |
fc557362 | 15 | @@ -1466,6 +1466,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, |
5ae2d14e WD |
16 | #endif |
17 | #ifdef SUPPORT_XATTRS | |
18 | if (preserve_xattrs) { | |
19 | + sx.st.st_mode = file->mode; | |
e8972101 WD |
20 | if (get_xattr(fname, &sx) < 0) { |
21 | io_error |= IOERR_GENERAL; | |
fc557362 | 22 | return NULL; |
5ae2d14e | 23 | diff --git a/xattrs.c b/xattrs.c |
fc557362 | 24 | index 2d0e050..3c70d8a 100644 |
5ae2d14e WD |
25 | --- a/xattrs.c |
26 | +++ b/xattrs.c | |
fc557362 | 27 | @@ -282,6 +282,10 @@ int get_xattr(const char *fname, stat_x *sxp) |
5ae2d14e WD |
28 | { |
29 | sxp->xattr = new(item_list); | |
30 | *sxp->xattr = empty_xattr; | |
31 | + | |
32 | + if (IS_SPECIAL(sxp->st.st_mode) || IS_DEVICE(sxp->st.st_mode)) | |
33 | + return 0; | |
34 | + | |
35 | if (rsync_xal_get(fname, sxp->xattr) < 0) { | |
36 | free_xattr(sxp); | |
37 | return -1; | |
fc557362 | 38 | @@ -865,6 +869,11 @@ int set_xattr(const char *fname, const struct file_struct *file, |
5ae2d14e WD |
39 | return -1; |
40 | } | |
41 | ||
42 | + if (IS_SPECIAL(sxp->st.st_mode) || IS_DEVICE(sxp->st.st_mode)) { | |
43 | + errno = ENOTSUP; | |
44 | + return -1; | |
45 | + } | |
46 | + | |
47 | ndx = F_XATTR(file); | |
48 | return rsync_xal_set(fname, lst + ndx, fnamecmp, sxp); | |
49 | } |