libselinux: selinux.py - use os.walk() instead of os.path.walk()

os.path.walk() function is deprecated and has been removed in Python 3

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
Miro Hrončok 2015-04-21 13:46:49 +02:00 committed by Steve Lawrence
parent 27d5377cc7
commit 42ac8d6dc4

View File

@ -31,9 +31,9 @@ def restorecon(path, recursive=False):
lsetfilecon(path, context)
if recursive:
os.path.walk(path, lambda arg, dirname, fnames:
map(restorecon, [os.path.join(dirname, fname)
for fname in fnames]), None)
for root, dirs, files in os.walk(path):
for name in files + dirs:
restorecon(os.path.join(root, name))
def chcon(path, context, recursive=False):
""" Set the SELinux context on a given path """