X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fselinux-setup.c;h=9ff27dcd77f03f0a1b7ab016d60deb3121b3e252;hb=347b9c4b1fc4f7368c006d8c95264a8e7d6df74c;hp=d4da693ca473485def0923e7b365d3ba348712a1;hpb=c4dcdb9f4785937f2b73700e66b8cafa452f60a7;p=elogind.git diff --git a/src/selinux-setup.c b/src/selinux-setup.c index d4da693ca..9ff27dcd7 100644 --- a/src/selinux-setup.c +++ b/src/selinux-setup.c @@ -39,11 +39,17 @@ int selinux_setup(char *const argv[]) { int enforce = 0; /* Already initialized? */ - if (path_is_mount_point("/selinux") > 0) + if (path_is_mount_point("/sys/fs/selinux") > 0 || + path_is_mount_point("/selinux") > 0) return 0; + /* Before we load the policy we create a flag file to ensure + * that after the reexec we iterate through /run and /dev to + * relabel things. */ + touch("/dev/.systemd-relabel-run-dev"); + if (selinux_init_load_policy(&enforce) == 0) { - log_info("Successfully loaded SELinux policy, reexecuting."); + log_debug("Successfully loaded SELinux policy, reexecuting."); /* FIXME: Ideally we'd just call setcon() here instead * of having to reexecute ourselves here. */ @@ -53,7 +59,9 @@ int selinux_setup(char *const argv[]) { return -errno; } else { - log_full(enforce > 0 ? LOG_ERR : LOG_DEBUG, "Failed to load SELinux policy."); + log_full(enforce > 0 ? LOG_ERR : LOG_WARNING, "Failed to load SELinux policy."); + + unlink("/dev/.systemd-relabel-run-dev"); if (enforce > 0) return -EIO;