mirror of
https://github.com/topjohnwu/selinux.git
synced 2025-02-24 05:13:36 +00:00
Mount sys before trying to mount selinuxfs
If /sys is not present, the attempt to mount selinuxfs will of course fail. So we try to mount /sys first (and only if that fails fall back to the /selinux mount point) and then try to mount selinuxfs. Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
This commit is contained in:
parent
3f52a123af
commit
ef3e072f58
@ -370,8 +370,16 @@ int selinux_init_load_policy(int *enforce)
|
||||
* mount it if present for use in the calls below.
|
||||
*/
|
||||
const char *mntpoint = NULL;
|
||||
if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||
mntpoint = SELINUXMNT;
|
||||
/* First make sure /sys is mounted */
|
||||
if (mount("sysfs", "/sys", "sysfs", 0, 0) == 0 || errno == EBUSY) {
|
||||
if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||
mntpoint = SELINUXMNT;
|
||||
} else {
|
||||
/* check old mountpoint */
|
||||
if (mount(SELINUXFS, OLDSELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||
mntpoint = OLDSELINUXMNT;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* check old mountpoint */
|
||||
if (mount(SELINUXFS, OLDSELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user