Minor MagiskHide adjustments

- Fail fast on unsupported systems
- Show proper fail message on unsupported systems
- inotify_fd shall be swapped out before closing to prevent
  the proc_monitor thread to read from incomplete inotify fd
This commit is contained in:
topjohnwu
2019-02-14 04:08:05 -05:00
parent d584360de2
commit 99db0672b4
4 changed files with 34 additions and 42 deletions

View File

@@ -297,7 +297,7 @@ static void set_hide_config() {
}
static inline void launch_err(int client, int code = DAEMON_ERROR) {
if (code == DAEMON_ERROR)
if (code != HIDE_IS_ENABLED)
hide_enabled = false;
if (client >= 0) {
write_int(client, code);
@@ -315,6 +315,9 @@ void launch_magiskhide(int client) {
if (hide_enabled)
launch_err(client, HIDE_IS_ENABLED);
if (access("/proc/1/ns/mnt", F_OK) != 0)
launch_err(client, HIDE_NO_NS);
hide_enabled = true;
set_hide_config();
LOGI("* Starting MagiskHide\n");