mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-25 18:27:23 +00:00
Keep disable file when module update
This commit is contained in:
parent
0835ff88b2
commit
fee4031d0f
@ -618,7 +618,12 @@ static void prepare_modules() {
|
|||||||
if (entry->d_type == DT_DIR) {
|
if (entry->d_type == DT_DIR) {
|
||||||
// Cleanup old module if exists
|
// Cleanup old module if exists
|
||||||
if (faccessat(mfd, entry->d_name, F_OK, 0) == 0) {
|
if (faccessat(mfd, entry->d_name, F_OK, 0) == 0) {
|
||||||
frm_rf(xopenat(mfd, entry->d_name, O_RDONLY | O_CLOEXEC));
|
int modfd = xopenat(mfd, entry->d_name, O_RDONLY | O_CLOEXEC);
|
||||||
|
if (faccessat(modfd, "disable", F_OK, 0) == 0) {
|
||||||
|
auto disable = entry->d_name + "/disable"s;
|
||||||
|
close(xopenat(ufd, disable.data(), O_RDONLY | O_CREAT | O_CLOEXEC, 0));
|
||||||
|
}
|
||||||
|
frm_rf(modfd);
|
||||||
unlinkat(mfd, entry->d_name, AT_REMOVEDIR);
|
unlinkat(mfd, entry->d_name, AT_REMOVEDIR);
|
||||||
}
|
}
|
||||||
LOGI("Upgrade / New module: %s\n", entry->d_name);
|
LOGI("Upgrade / New module: %s\n", entry->d_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user