mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-11 02:22:25 +00:00
Support SELinux disabled on debug builds
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <base.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -101,7 +102,23 @@ void setfilecon_at(int dirfd, const char *name, const char *con) {
|
||||
lsetfilecon(path, con);
|
||||
}
|
||||
|
||||
#if MAGISK_DEBUG
|
||||
static bool se_state = false;
|
||||
bool selinux_enabled() {
|
||||
return se_state;
|
||||
}
|
||||
#else
|
||||
bool selinux_enabled() {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void enable_selinux() {
|
||||
#if MAGISK_DEBUG
|
||||
if (access(SELINUX_MNT, F_OK) != 0)
|
||||
return;
|
||||
se_state = true;
|
||||
#endif
|
||||
setcon = __setcon;
|
||||
getfilecon = __getfilecon;
|
||||
lgetfilecon = __lgetfilecon;
|
||||
|
||||
Reference in New Issue
Block a user