1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 14:41:43 +00:00

restore_xattrs: minor cleanup / simplification

if we use {} as default for item.get(), we do not need the "if" as iteration over an empty dict won't do anything.
also fixes too deep indentation the original code had.
This commit is contained in:
Thomas Waldmann 2015-08-28 23:22:26 +02:00
parent 034e3477bd
commit ea8f3bd7e7

View file

@ -323,8 +323,7 @@ def extract_item(self, item, restore_attrs=True, dry_run=False, stdout=False, sp
raise Exception('Unknown archive item type %r' % item[b'mode']) raise Exception('Unknown archive item type %r' % item[b'mode'])
def restore_attrs(self, path, item, symlink=False, fd=None): def restore_attrs(self, path, item, symlink=False, fd=None):
xattrs = item.get(b'xattrs') xattrs = item.get(b'xattrs', {})
if xattrs:
for k, v in xattrs.items(): for k, v in xattrs.items():
try: try:
xattr.setxattr(fd or path, k, v, follow_symlinks=False) xattr.setxattr(fd or path, k, v, follow_symlinks=False)