mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 07:37:39 +00:00
parent
2bef967af1
commit
7da36079c1
@ -172,10 +172,16 @@ struct resetprop : public sysprop {
|
|||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
auto pi = const_cast<prop_info *>(__system_property_find(name));
|
auto pi = const_cast<prop_info *>(__system_property_find(name));
|
||||||
|
|
||||||
|
// Always delete existing read-only properties, because they could be
|
||||||
|
// long properties and cannot directly go through __system_property_update
|
||||||
|
if (pi != nullptr && str_starts(name, "ro.")) {
|
||||||
|
delprop(name, false);
|
||||||
|
pi = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (pi != nullptr) {
|
if (pi != nullptr) {
|
||||||
if (prop_svc) {
|
if (prop_svc) {
|
||||||
if (strncmp(name, "ro.", 3) == 0)
|
|
||||||
delprop(name, false);
|
|
||||||
ret = system_property_set(name, value);
|
ret = system_property_set(name, value);
|
||||||
} else {
|
} else {
|
||||||
ret = __system_property_update(pi, value, strlen(value));
|
ret = __system_property_update(pi, value, strlen(value));
|
||||||
@ -216,13 +222,18 @@ struct resetprop : public sysprop {
|
|||||||
callback(key.data(), val.data(), cookie);
|
callback(key.data(), val.data(), cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not an error when something is deleted
|
||||||
int delprop(const char *name, bool persist) override {
|
int delprop(const char *name, bool persist) override {
|
||||||
if (!check_legal_property_name(name))
|
if (!check_legal_property_name(name))
|
||||||
return 1;
|
return 1;
|
||||||
LOGD("resetprop: delete prop [%s]\n", name);
|
LOGD("resetprop: delete prop [%s]\n", name);
|
||||||
if (persist && strncmp(name, "persist.", 8) == 0)
|
|
||||||
persist = persist_deleteprop(name);
|
int ret = __system_property_delete(name);
|
||||||
return __system_property_delete(name) && !(persist && strncmp(name, "persist.", 8) == 0);
|
if (persist && str_starts(name, "persist.")) {
|
||||||
|
if (persist_deleteprop(name))
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user