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
ff6bae93
Commit
ff6bae93
authored
Sep 30, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix root shell racing condition
parent
62523c81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+1
-1
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+7
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
ff6bae93
...
...
@@ -46,7 +46,7 @@ public class Async {
String
busybox
=
mContext
.
getApplicationInfo
().
dataDir
+
"/lib/libbusybox.so"
;
String
zip
=
mContext
.
getApplicationInfo
().
dataDir
+
"/lib/libzip.so"
;
if
(
Shell
.
rootAccess
())
{
if
(!
Utils
.
itemExist
(
toolPath
))
{
if
(!
Utils
.
itemExist
(
false
,
toolPath
))
{
Shell
.
sh
(
"rm -rf "
+
toolPath
,
"mkdir "
+
toolPath
,
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
ff6bae93
...
...
@@ -65,14 +65,16 @@ public class Utils {
}
public
static
boolean
itemExist
(
String
path
)
{
List
<
String
>
ret
;
return
itemExist
(
true
,
path
);
}
public
static
boolean
itemExist
(
boolean
root
,
String
path
)
{
String
command
=
"if [ -e "
+
path
+
" ]; then echo true; else echo false; fi"
;
if
(
Shell
.
rootAccess
())
{
ret
=
Shell
.
su
(
command
);
if
(
Shell
.
rootAccess
()
&&
root
)
{
ret
urn
Boolean
.
parseBoolean
(
Shell
.
su
(
command
).
get
(
0
)
);
}
else
{
ret
=
Shell
.
sh
(
command
);
ret
urn
new
File
(
path
).
exists
(
);
}
return
Boolean
.
parseBoolean
(
ret
.
get
(
0
));
}
public
static
boolean
commandExists
(
String
s
)
{
...
...
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