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
827057b9
Commit
827057b9
authored
Jan 30, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Concat commands when using -c
parent
17164522
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
su.c
su.c
+15
-1
No files found.
su.c
View file @
827057b9
...
@@ -586,6 +586,17 @@ static void fork_for_samsung(void)
...
@@ -586,6 +586,17 @@ static void fork_for_samsung(void)
}
}
}
}
static
void
concat_commands
(
char
*
command
,
int
argc
,
char
*
argv
[])
{
int
i
;
command
[
0
]
=
'\0'
;
for
(
i
=
optind
-
1
;
i
<
argc
;
++
i
)
{
if
(
strlen
(
command
))
sprintf
(
command
,
"%s %s"
,
command
,
argv
[
i
]);
else
sprintf
(
command
,
"%s"
,
argv
[
i
]);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"--daemon"
)
==
0
)
{
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"--daemon"
)
==
0
)
{
//Everything we'll exec will be in su, not su_daemon
//Everything we'll exec will be in su, not su_daemon
...
@@ -709,7 +720,10 @@ int su_main_nodaemon(int argc, char **argv) {
...
@@ -709,7 +720,10 @@ int su_main_nodaemon(int argc, char **argv) {
switch
(
c
)
{
switch
(
c
)
{
case
'c'
:
case
'c'
:
ctx
.
to
.
shell
=
DEFAULT_SHELL
;
ctx
.
to
.
shell
=
DEFAULT_SHELL
;
ctx
.
to
.
command
=
optarg
;
char
command
[
ARG_MAX
];
concat_commands
(
command
,
argc
,
argv
);
ctx
.
to
.
command
=
command
;
optind
=
argc
;
break
;
break
;
case
'h'
:
case
'h'
:
usage
(
EXIT_SUCCESS
);
usage
(
EXIT_SUCCESS
);
...
...
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