mirror of
https://github.com/SELinuxProject/selinux
synced 2025-05-03 16:17:59 +00:00
sepolicy: do not fail when file_contexts.local does not exist
When running "sepolicy manpage" on a system without file_contexts.local, the command fails with: FileNotFoundError: [Errno 2] No such file or directory: '//etc/selinux/refpolicy/contexts/files/file_contexts.local' Verify that the file exists before using it. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
3edb139789
commit
d329bb5465
@ -573,9 +573,10 @@ def get_fcdict(fc_path=selinux.selinux_file_context_path()):
|
||||
fc += fd.readlines()
|
||||
fd.close()
|
||||
fcdict = {}
|
||||
fd = open(fc_path + ".local", "r")
|
||||
fc += fd.readlines()
|
||||
fd.close()
|
||||
if os.path.exists(fc_path + ".local"):
|
||||
fd = open(fc_path + ".local", "r")
|
||||
fc += fd.readlines()
|
||||
fd.close()
|
||||
|
||||
for i in fc:
|
||||
rec = i.split()
|
||||
|
Loading…
Reference in New Issue
Block a user