mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 05:07:37 +00:00
Preserve at least 32M free size
This commit is contained in:
parent
aa92e4cbd0
commit
f872a122a9
@ -110,7 +110,7 @@ static int get_img_size(const char *img, int *used, int *total) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define round_size(a) ((((a) / 32) + 1) * 32)
|
||||
#define round_size(a) ((((a) / 32) + 2) * 32)
|
||||
|
||||
static int resize_img(const char *img, int size) {
|
||||
LOGI("resize %s to %dM\n", img, size);
|
||||
@ -179,7 +179,7 @@ static void trim_img(const char *img) {
|
||||
int used, total, new_size;
|
||||
get_img_size(img, &used, &total);
|
||||
new_size = round_size(used);
|
||||
if (new_size < total)
|
||||
if (new_size != total)
|
||||
resize_img(img, new_size);
|
||||
}
|
||||
|
||||
@ -694,7 +694,7 @@ void post_fs_data(int client) {
|
||||
}
|
||||
|
||||
// Start magiskhide if enabled
|
||||
char *hide_prop = getprop("persist.magisk.hide");
|
||||
char *hide_prop = getprop(MAGISKHIDE_PROP);
|
||||
if (hide_prop) {
|
||||
if (strcmp(hide_prop, "1") == 0) {
|
||||
pthread_t thread;
|
||||
|
@ -45,6 +45,8 @@
|
||||
#define SELINUX_POLICY SELINUX_PATH "policy"
|
||||
#define SELINUX_LOAD SELINUX_PATH "load"
|
||||
|
||||
#define MAGISKHIDE_PROP "persist.magisk.hide"
|
||||
|
||||
// Global handler for PLOGE
|
||||
extern __thread void (*err_handler)(void);
|
||||
|
||||
|
@ -56,7 +56,7 @@ void launch_magiskhide(int client) {
|
||||
hideEnabled = 1;
|
||||
|
||||
if (client != -1) {
|
||||
if (setprop("persist.magisk.hide", "1"))
|
||||
if (setprop(MAGISKHIDE_PROP, "1"))
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ void stop_magiskhide(int client) {
|
||||
LOGI("* Stopping MagiskHide\n");
|
||||
|
||||
hideEnabled = 0;
|
||||
setprop("persist.magisk.hide", "0");
|
||||
setprop(MAGISKHIDE_PROP, "0");
|
||||
pthread_kill(proc_monitor_thread, SIGUSR1);
|
||||
|
||||
write_int(client, DAEMON_SUCCESS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user