mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-19 04:34:30 +00:00
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:
parent
27d5377cc7
commit
42ac8d6dc4
@ -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 """
|
||||
|
Loading…
Reference in New Issue
Block a user