Commit 90545057 authored by topjohnwu's avatar topjohnwu

Always initialize module_list

Close #5712
parent cffd024e
...@@ -391,6 +391,7 @@ static void daemon_entry() { ...@@ -391,6 +391,7 @@ static void daemon_entry() {
default_new(poll_map); default_new(poll_map);
default_new(poll_fds); default_new(poll_fds);
default_new(module_list);
// Register handler for main socket // Register handler for main socket
pollfd main_socket_pfd = { fd, POLLIN, 0 }; pollfd main_socket_pfd = { fd, POLLIN, 0 };
......
...@@ -583,34 +583,32 @@ void magic_mount() { ...@@ -583,34 +583,32 @@ void magic_mount() {
char buf[4096]; char buf[4096];
LOGI("* Loading modules\n"); LOGI("* Loading modules\n");
if (module_list) { for (const auto &m : *module_list) {
for (const auto &m : *module_list) { const char *module = m.name.data();
const char *module = m.name.data(); char *b = buf + sprintf(buf, "%s/" MODULEMNT "/%s/", MAGISKTMP.data(), module);
char *b = buf + sprintf(buf, "%s/" MODULEMNT "/%s/", MAGISKTMP.data(), module);
// Read props
// Read props strcpy(b, "system.prop");
strcpy(b, "system.prop"); if (access(buf, F_OK) == 0) {
if (access(buf, F_OK) == 0) { LOGI("%s: loading [system.prop]\n", module);
LOGI("%s: loading [system.prop]\n", module); load_prop_file(buf, false);
load_prop_file(buf, false); }
}
// Check whether skip mounting // Check whether skip mounting
strcpy(b, "skip_mount"); strcpy(b, "skip_mount");
if (access(buf, F_OK) == 0) if (access(buf, F_OK) == 0)
continue; continue;
// Double check whether the system folder exists // Double check whether the system folder exists
strcpy(b, "system"); strcpy(b, "system");
if (access(buf, F_OK) != 0) if (access(buf, F_OK) != 0)
continue; continue;
LOGI("%s: loading mount files\n", module); LOGI("%s: loading mount files\n", module);
b[-1] = '\0'; b[-1] = '\0';
int fd = xopen(buf, O_RDONLY | O_CLOEXEC); int fd = xopen(buf, O_RDONLY | O_CLOEXEC);
system->collect_files(module, fd); system->collect_files(module, fd);
close(fd); close(fd);
}
} }
if (MAGISKTMP != "/sbin") { if (MAGISKTMP != "/sbin") {
// Need to inject our binaries into /system/bin // Need to inject our binaries into /system/bin
...@@ -768,7 +766,6 @@ static void collect_modules(bool open_zygisk) { ...@@ -768,7 +766,6 @@ static void collect_modules(bool open_zygisk) {
} }
void handle_modules() { void handle_modules() {
default_new(module_list);
prepare_modules(); prepare_modules();
collect_modules(false); collect_modules(false);
exec_module_scripts("post-fs-data"); exec_module_scripts("post-fs-data");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment