Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
7da36079
Commit
7da36079
authored
Mar 29, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always delete existing ro props at setprop
Close #4113
parent
2bef967a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
resetprop.cpp
native/jni/resetprop/resetprop.cpp
+16
-5
No files found.
native/jni/resetprop/resetprop.cpp
View file @
7da36079
...
...
@@ -172,10 +172,16 @@ struct resetprop : public sysprop {
int
ret
;
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
(
prop_svc
)
{
if
(
strncmp
(
name
,
"ro."
,
3
)
==
0
)
delprop
(
name
,
false
);
ret
=
system_property_set
(
name
,
value
);
}
else
{
ret
=
__system_property_update
(
pi
,
value
,
strlen
(
value
));
...
...
@@ -216,13 +222,18 @@ struct resetprop : public sysprop {
callback
(
key
.
data
(),
val
.
data
(),
cookie
);
}
// Not an error when something is deleted
int
delprop
(
const
char
*
name
,
bool
persist
)
override
{
if
(
!
check_legal_property_name
(
name
))
return
1
;
LOGD
(
"resetprop: delete prop [%s]
\n
"
,
name
);
if
(
persist
&&
strncmp
(
name
,
"persist."
,
8
)
==
0
)
persist
=
persist_deleteprop
(
name
);
return
__system_property_delete
(
name
)
&&
!
(
persist
&&
strncmp
(
name
,
"persist."
,
8
)
==
0
);
int
ret
=
__system_property_delete
(
name
);
if
(
persist
&&
str_starts
(
name
,
"persist."
))
{
if
(
persist_deleteprop
(
name
))
ret
=
0
;
}
return
ret
;
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment