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
dd35224f
Commit
dd35224f
authored
Sep 01, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor adjustments to exec_sql
parent
1283590e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
db.cpp
native/jni/core/db.cpp
+10
-9
magisk.cpp
native/jni/core/magisk.cpp
+8
-2
No files found.
native/jni/core/db.cpp
View file @
dd35224f
...
...
@@ -274,23 +274,24 @@ int validate_manager(string &alt_pkg, int userid, struct stat *st) {
void
exec_sql
(
int
client
)
{
char
*
sql
=
read_string
(
client
);
FILE
*
out
=
fdopen
(
recv_fd
(
client
),
"a"
);
char
*
err
=
db_exec
(
sql
,
[
&
](
db_row
&
row
)
->
bool
{
bool
first
=
false
;
string
out
;
bool
first
=
true
;
for
(
auto
it
:
row
)
{
if
(
first
)
fprintf
(
out
,
"|"
);
else
first
=
true
;
fprintf
(
out
,
"%s=%s"
,
it
.
first
.
data
(),
it
.
second
.
data
());
if
(
first
)
first
=
false
;
else
out
+=
'|'
;
out
+=
it
.
first
;
out
+=
'='
;
out
+=
it
.
second
;
}
fprintf
(
out
,
"
\n
"
);
write_int
(
client
,
out
.
length
());
xwrite
(
client
,
out
.
data
(),
out
.
length
());
return
true
;
});
free
(
sql
);
fclose
(
out
);
db_err_cmd
(
err
,
write_int
(
client
,
1
);
write_int
(
client
,
0
);
return
;
);
write_int
(
client
,
0
);
close
(
client
);
}
native/jni/core/magisk.cpp
View file @
dd35224f
...
...
@@ -105,8 +105,14 @@ int magisk_main(int argc, char *argv[]) {
int
fd
=
connect_daemon
();
write_int
(
fd
,
SQLITE_CMD
);
write_string
(
fd
,
argv
[
2
]);
send_fd
(
fd
,
STDOUT_FILENO
);
return
read_int
(
fd
);
for
(;;)
{
char
*
res
=
read_string
(
fd
);
if
(
res
[
0
]
==
'\0'
)
{
return
0
;
}
printf
(
"%s
\n
"
,
res
);
free
(
res
);
}
}
else
if
(
argv
[
1
]
==
"--use-broadcast"
sv
)
{
int
fd
=
connect_daemon
();
write_int
(
fd
,
BROADCAST_ACK
);
...
...
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