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
fe89f9e5
Commit
fe89f9e5
authored
Apr 16, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to newer functions in resetprop
parent
73802aab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
resetprop.cpp
jni/resetprop/resetprop.cpp
+9
-5
No files found.
jni/resetprop/resetprop.cpp
View file @
fe89f9e5
...
...
@@ -80,7 +80,6 @@ int main(int argc, char *argv[]) {
static
int
verbose
=
0
;
static
bool
is_legal_property_name
(
const
char
*
name
,
size_t
namelen
)
{
if
(
namelen
>=
PROP_NAME_MAX
)
return
false
;
if
(
namelen
<
1
)
return
false
;
if
(
name
[
0
]
==
'.'
)
return
false
;
if
(
name
[
namelen
-
1
]
==
'.'
)
return
false
;
...
...
@@ -126,14 +125,20 @@ int init_resetprop() {
return
0
;
}
static
void
read_prop_info
(
void
*
cookie
,
const
char
*
name
,
const
char
*
value
,
uint32_t
serial
)
{
strcpy
((
char
*
)
cookie
,
value
);
}
// Get prop by name, return string (should free manually!)
char
*
getprop
(
const
char
*
name
)
{
char
value
[
PROP_VALUE_MAX
];
LOGD
(
"restprop: getprop [%s]
\n
"
,
name
);
if
(
__system_property_get
(
name
,
value
)
==
0
)
{
const
prop_info
*
pi
=
__system_property_find
(
name
);
if
(
pi
==
NULL
)
{
LOGE
(
"resetprop: prop not found: [%s]
\n
"
,
name
);
return
NULL
;
}
char
value
[
PROP_VALUE_MAX
];
__system_property_read_callback
(
pi
,
read_prop_info
,
value
);
LOGD
(
"resetprop: getprop [%s]: [%s]
\n
"
,
name
,
value
);
return
strdup
(
value
);
}
...
...
@@ -146,7 +151,6 @@ int setprop2(const char *name, const char *value, int trigger) {
char
*
check
=
getprop
(
name
);
if
(
check
)
{
LOGD
(
"resetprop: prop [%s] has existing value [%s]
\n
"
,
name
,
value
);
free
(
check
);
if
(
trigger
)
{
if
(
!
strncmp
(
name
,
"ro."
,
3
))
deleteprop
(
name
);
...
...
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