Fix xattr issue on OS X.

This commit is contained in:
Jonas Borgström 2013-08-05 20:38:37 +02:00
parent a51a10a96c
commit 7815ed5885
2 changed files with 7 additions and 2 deletions

View file

@ -206,7 +206,7 @@ class ArchiverTestCase(AtticTestCase):
name = sorted(os.listdir(os.path.join(self.tmpdir, 'repository', 'data', '0')), reverse=True)[0]
fd = open(os.path.join(self.tmpdir, 'repository', 'data', '0', name), 'r+')
fd.seek(100)
fd.write('X')
fd.write('XXXX')
fd.close()
self.attic('verify', self.repository_location + '::test', exit_code=1)

View file

@ -124,7 +124,12 @@ except ImportError:
func = libc.flistxattr
elif not follow_symlinks:
flags = XATTR_NOFOLLOW
n = _check(func(path, None, 0, flags), path)
try:
n = _check(func(path, None, 0, flags), path)
except OSError as e:
if e.errno == errno.EPERM:
return []
raise
if n == 0:
return []
namebuf = create_string_buffer(n)