mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-15 22:13:11 +00:00
Add boot_complete trigger back
Samsung does not like running cmd before system services are started. Instead of failing, it will enter an infinite wait on binder. Move APK installation to boot complete to make sure pm can be run without blocking process.
This commit is contained in:
@@ -49,20 +49,16 @@ int fork_no_zombie() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool rand_init = false;
|
||||
|
||||
void gen_rand_str(char *buf, int len) {
|
||||
const char base[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
int urandom;
|
||||
if (access("/dev/urandom", R_OK) == 0) {
|
||||
urandom = xopen("/dev/urandom", O_RDONLY | O_CLOEXEC);
|
||||
} else {
|
||||
mknod("/urandom", S_IFCHR | 0666, makedev(1, 9));
|
||||
urandom = xopen("/urandom", O_RDONLY | O_CLOEXEC);
|
||||
unlink("/urandom");
|
||||
constexpr const char base[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
if (!rand_init) {
|
||||
srand(time(nullptr));
|
||||
rand_init = true;
|
||||
}
|
||||
xxread(urandom, buf, len - 1);
|
||||
close(urandom);
|
||||
for (int i = 0; i < len - 1; ++i) {
|
||||
buf[i] = base[buf[i] % (sizeof(base) - 1)];
|
||||
buf[i] = base[rand() % (sizeof(base) - 1)];
|
||||
}
|
||||
buf[len - 1] = '\0';
|
||||
}
|
||||
|
Reference in New Issue
Block a user