mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-22 21:33:05 +00:00
dbus: Fix FileNotFoundError in org.selinux.relabel_on_boot
When org.selinux.relabel_on_boot(0) was called twice, it failed with FileNotFoundError. Fixes: $ dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.relabel_on_boot int64:1 method return sender=:1.53 -> dest=:1.54 reply_serial=2 $ dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.relabel_on_boot int64:0 method return sender=:1.53 -> dest=:1.55 reply_serial=2 $ dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.relabel_on_boot int64:0 Error org.freedesktop.DBus.Python.FileNotFoundError: FileNotFoundError: [Errno 2] No such file or directory: '/.autorelabel' Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
parent
214cb61d53
commit
adb8bdd429
@ -85,7 +85,10 @@ class selinux_server(slip.dbus.service.Object):
|
||||
fd = open("/.autorelabel", "w")
|
||||
fd.close()
|
||||
else:
|
||||
os.unlink("/.autorelabel")
|
||||
try:
|
||||
os.unlink("/.autorelabel")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
def write_selinux_config(self, enforcing=None, policy=None):
|
||||
path = selinux.selinux_path() + "config"
|
||||
|
Loading…
Reference in New Issue
Block a user