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
0c28b232
Commit
0c28b232
authored
Dec 09, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix install_module command
parent
ec1af9dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
scripting.cpp
native/jni/core/scripting.cpp
+10
-11
No files found.
native/jni/core/scripting.cpp
View file @
0c28b232
...
@@ -102,12 +102,12 @@ void install_apk(const char *apk) {
...
@@ -102,12 +102,12 @@ void install_apk(const char *apk) {
exec_command_sync
(
exec
,
"/system/bin/sh"
,
"-c"
,
cmds
);
exec_command_sync
(
exec
,
"/system/bin/sh"
,
"-c"
,
cmds
);
}
}
[[
noreturn
]]
__printflike
(
1
,
2
)
[[
noreturn
]]
__printflike
(
2
,
3
)
static
void
abort
(
const
char
*
fmt
,
...)
{
static
void
abort
(
FILE
*
fp
,
const
char
*
fmt
,
...)
{
va_list
valist
;
va_list
valist
;
va_start
(
valist
,
fmt
);
va_start
(
valist
,
fmt
);
vfprintf
(
stderr
,
fmt
,
valist
);
vfprintf
(
fp
,
fmt
,
valist
);
fprintf
(
stderr
,
"
\n\n
"
);
fprintf
(
fp
,
"
\n\n
"
);
va_end
(
valist
);
va_end
(
valist
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -121,14 +121,13 @@ exit 0'
...
@@ -121,14 +121,13 @@ exit 0'
void
install_module
(
const
char
*
file
)
{
void
install_module
(
const
char
*
file
)
{
if
(
getuid
()
!=
0
)
if
(
getuid
()
!=
0
)
abort
(
"Run this command with root"
);
abort
(
stderr
,
"Run this command with root"
);
if
(
access
(
DATABIN
,
F_OK
)
||
if
(
access
(
DATABIN
,
F_OK
)
||
access
(
DATABIN
"/busybox"
,
X_OK
)
||
access
(
DATABIN
"/busybox"
,
X_OK
)
||
access
(
DATABIN
"/util_functions.sh"
,
F_OK
))
access
(
DATABIN
"/util_functions.sh"
,
F_OK
))
abort
(
"Incomplete Magisk install"
);
abort
(
stderr
,
"Incomplete Magisk install"
);
if
(
access
(
file
,
F_OK
))
{
if
(
access
(
file
,
F_OK
))
abort
(
"'%s' does not exist"
,
file
);
abort
(
stderr
,
"'%s' does not exist"
,
file
);
}
setenv
(
"OUTFD"
,
"1"
,
1
);
setenv
(
"OUTFD"
,
"1"
,
1
);
setenv
(
"ZIPFILE"
,
file
,
1
);
setenv
(
"ZIPFILE"
,
file
,
1
);
...
@@ -138,7 +137,7 @@ void install_module(const char *file) {
...
@@ -138,7 +137,7 @@ void install_module(const char *file) {
xdup2
(
fd
,
STDERR_FILENO
);
xdup2
(
fd
,
STDERR_FILENO
);
close
(
fd
);
close
(
fd
);
const
char
*
argv
[]
=
{
"/system/bin/sh"
,
"-c"
,
install_module_script
};
const
char
*
argv
[]
=
{
"/system/bin/sh"
,
"-c"
,
install_module_script
,
nullptr
};
execve
(
argv
[
0
],
(
char
**
)
argv
,
environ
);
execve
(
argv
[
0
],
(
char
**
)
argv
,
environ
);
abort
(
"Failed to execute BusyBox shell"
);
abort
(
stdout
,
"Failed to execute BusyBox shell"
);
}
}
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