mirror of
https://github.com/SELinuxProject/selinux
synced 2025-04-07 18:29:17 +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
3b44fe10e5
commit
6068fcb361
@ -370,6 +370,8 @@ int selinux_init_load_policy(int *enforce)
|
|||||||
* mount it if present for use in the calls below.
|
* mount it if present for use in the calls below.
|
||||||
*/
|
*/
|
||||||
const char *mntpoint = NULL;
|
const char *mntpoint = NULL;
|
||||||
|
/* 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) {
|
if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||||
mntpoint = SELINUXMNT;
|
mntpoint = SELINUXMNT;
|
||||||
} else {
|
} else {
|
||||||
@ -378,6 +380,12 @@ int selinux_init_load_policy(int *enforce)
|
|||||||
mntpoint = OLDSELINUXMNT;
|
mntpoint = OLDSELINUXMNT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* check old mountpoint */
|
||||||
|
if (mount(SELINUXFS, OLDSELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
|
||||||
|
mntpoint = OLDSELINUXMNT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! mntpoint ) {
|
if (! mntpoint ) {
|
||||||
if (errno == ENODEV || !selinuxfs_exists()) {
|
if (errno == ENODEV || !selinuxfs_exists()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user